1

我正在尝试使用这个扩展:https ://github.com/aleray/mdx_semanticdata和 django-wiki 的降价,但我无法让它工作(虽然它在 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 和语义数据作为扩展,请参阅底部的 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 中的 span 具有 content 和 property tags。我想在 django-wiki 中有内容和属性标签。任何人都可以帮忙吗?

我的设置.py:

WIKI_MARKDOWN_KWARGS = { 'extensions': [ 'semanticdata', 'footnotes', 'attr_list', 'headerid', 'extra', 'mdx_semanticdata', ], 'safe_mode': False, }

4

1 回答 1

1

它与 django-wiki 如何清理其输入有关。设置WIKI_MARKDOWN_SANITIZE_HTMLFalse解决问题,但显然不建议这样做。

于 2017-11-12T04:47:34.817 回答