Closed JTP-123 closed 11 months ago
Python Markdown is not the appropriate place to ask questions about 3rd party extensions. You already asked in the appropriate place: https://github.com/facelessuser/pymdown-extensions/discussions/2192, and I've answered as best as can be done.
You need to debug your flask app to find what you are doing wrong. I've already provided you with a working example you can compare against.
As a new beginner, I decided to make my small tiny flask blog support math formula, so I chose arithmatex under python-markdown. After I have read offical documentation, i made such configuration as follows, namely I put mathjax cdn link at the bottom of the block script of base.html template, arithmatex is included by markdown function. But it doesn't work. Can anyone give me a favor? thank you.
include arithmatex
def on_changed_body(target, value, oldvalue, initiator): allowed_tags = ['a', 'abbr', 'acronym', 'b', 'blockquote', 'code', # define allowed html tags for Markdown 'em', 'i', 'li', 'ol', 'pre', 'strong', 'ul', 'h1', 'h2', 'h3', 'p', 'img', 'kbd', 'sup', 'sub', 'br', 'table', 'footer', 'thead', 'tbody', 'tr', 'th', 'td', 'small', 'big'] extensions = ['pymdownx.arithmatex', 'pymdownx.b64', 'pymdownx.emoji'] target.body_html = bleach.linkify(bleach.clean( markdown(value, output_format='html', extensions=extensions, extension_configs={ "pymdownx.arithmatex": { "generic": True } }), tags=allowed_tags, strip=True))
part of base.html:
{% block scripts %} ... // other script code like moment.js, self-defined js function
{% endblock %}
but after my configuration ends, it still produces a plain text, not math formula: