Michael
Michael

Reputation: 853

cannot integrate third party markdown extension into django-wiki markdown

I'm trying to use this extension: https://github.com/aleray/mdx_semanticdata with django-wiki's markdown but I am unable to get it to work (though it works in the python/django shell just fine). (django-wiki: https://github.com/django-wiki/django-wiki/)

Adding this line

%%dc:author :: Sherry Turkle | Turkle's%% %%dc:title::Second Self%% was an early book on the social aspects of computation.

to a django-wiki article (with mdx_semanticdata and semanticdata as extensions, see settings.py at the bottom) gives me

<p><span>Turkle's</span> <span>Second Self</span> was an early book on the social aspects of computation."</p>

Whereas doing

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)

In the python shell gives me:

<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>

Notice the spans from the python shell have content and property tags. I would like to have the content and property tags in django-wiki. Can anyone help?

My settings.py:

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

Upvotes: 1

Views: 184

Answers (1)

Michael
Michael

Reputation: 853

It has to do with how django-wiki sanitizes its inputs. Settings WIKI_MARKDOWN_SANITIZE_HTML to False solved the problem, but obviously this is not recommended.

Upvotes: 1

Related Questions