我正在尝试使用此扩展程序:https://github.com/aleray/mdx_semanticdata使用 django-wiki 的 markdown 但我无法让它工作(尽管它在 python/django shell 中工作得很好)。 (django-wiki:https://github.com/django-wiki/django-wiki/)
添加此行
%%dc:author :: Sherry Turkle | Turkle's%% %%dc:title::Second Self%% was an early book on the social aspects of computation.
一篇 django-wiki 文章(以 mdx_semanticdata 和 Semanticdata 作为扩展,请参阅底部的 settings.py)给了我
<p><span>Turkle's</span> <span>Second Self</span> was an early book on the social aspects of computation."</p>
虽然在做
import markdown
text = "%%dc:author :: Sherry Turkle | Turkle's%% %%dc:title::Second Self%% was an early book on the social aspects of computation."
html = markdown.markdown(text, ['semanticdata'])
print(html)
在 python shell 中给我:
<p><span content="Sherry Turkle" property="dc:author">Turkle's</span> <span content="Second Self" property="dc:title">Second Self</span> was an early book on the social aspects of computation.</p>
请注意,Python shell 中的跨度具有内容和属性标签。我想在 django-wiki 中拥有内容和属性标签。有人可以帮忙吗?
我的设置.py:
WIKI_MARKDOWN_KWARGS = {
'extensions': [
'semanticdata',
'footnotes',
'attr_list',
'headerid',
'extra',
'mdx_semanticdata',
],
'safe_mode': False,
}
最佳答案
这与 django-wiki 如何清理其输入有关。将 WIKI_MARKDOWN_SANITIZE_HTML
设置为 False
解决了问题,但显然不建议这样做。
关于python - 无法将第三方 Markdown 扩展集成到 django-wiki Markdown 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47245444/