Closed garyvdm closed 5 years ago
Definitely something I've considered.
global config would make this possible, and that's the easiest way to add support. I also think that the jinja2 extension could look for options so that you can control this per-tag. e.g.
extensions:
# i prefer misaka these days
- strange_case.extensions.misaka
# but markdown2 would have similar configurability
- strange_case.extensions.markdown
misaka:
# arguments to the misaka.Markdown() constructor
markdown: [fenced_code, no_intra_emphasis, strikethrough, superscript, tables]
# arguments to the misaka.HtmlRenderer() constructor
renderer: [smartypants]
markdown:
extras: [ fenced-code-blocks, header-ids, code-friendly ]
{# misaka. i'm not sure how to detect renderer vs html options other than
maintaining a list of available options somewhere #}
{% markdown no_intra_emphasis strikethrough autolink skip_html %}
{# markdown2 #}
{% markdown fenced_code %}
I'll see what I can whip up, not a lot of time in the near future, but I'll definitely get to this. The tag version is easier, it's a matter of searching for arguments, and using a different markdowner
function than the default.
renderer = MyRenderer(m.HTML_SMARTYPANTS)
markdowner = m.Markdown(renderer, m.EXT_FENCED_CODE | m.EXT_NO_INTRA_EMPHASIS |
m.EXT_STRIKETHROUGH | m.EXT_SUPERSCRIPT |
m.EXT_TABLES)
I would like to be able to change the markdown extras used.
This would require some mechanism to provide configuration information to a extension.