Reputation: 1598
Using Mezzanine with Pagedown I would like to embed a Youtube video. The only way I've been able to make this work is by removing RICHTEXT_FILTERS
from seetings.py
which obviously won't work
RICHTEXT_WIDGET_CLASS = 'mezzanine_pagedown.widgets.PageDownWidget'
RICHTEXT_FILTER = 'mezzanine_pagedown.filters.custom'
RICHTEXT_FILTERS = (RICHTEXT_FILTER,)
PAGEDOWN_MARKDOWN_EXTENSIONS = ('extra','codehilite','toc')
RICHTEXT_FILTER_LEVEL = 3 #changed from 3. This allows iframes.
PAGEDOWN_SERVER_SIDE_PREVIEW = True
Before you ask, this is a simple site and I am the only user. Readers don't need the ability to comment. XSS is not an issue.
Upvotes: 1
Views: 328
Reputation: 46
Embedded videos are not supported by the standard markdown specification, or by the stock python-markdown converter.
There are two issues to consider when trying to support new content elements in mezzanine-pagedown
:
The markdown converter (python-markdown) must recognize the element, typically through using an additional custom python-markdown extension, which you can then add to the PAGEDOWN_MARKDOWN_EXTENSIONS
setting. Alternatively, you can use inline HTML within your markdown documents.
The resulting HTML content after the conversion (or the inline HTML) must be legal as per the standard Mezzanine settings: RICHTEXT_ALLOWED_TAGS
, RICHTEXT_ALLOWED_ATTRIBUTES
, and RICHTEXT_ALLOWED_STYLES
. These settings are applied to the markdown-generated HTML by mezzanine-pagedown.
Upvotes: 3