You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
markdown-it-py works great but if my markdown source contains some codeblock sections such as mermaid and diff then in order for these to render properly I've got to manually add a block to the end of my html:
<linkrel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css"><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script><!-- and it's easy to individually load additional languages --><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/go.min.js"></script><script>hljs.highlightAll();</script><script>document.querySelectorAll('.language-mermaid').forEach(s=>s.classList.add("mermaid"))</script><scriptsrc="https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.min.js"></script><script>mermaid.initialize({startOnLoad:true})</script>
I don't expect markdown-it-py to know to add this, but is there a way to have my required includes included automatically when html_text = md.render(text) is executed? Or is there an even better way?
(You may correctly deduce that I am pretty basic when it comes to web; it took me a long time to realise that i needed to add these scripts and that it was not a limitation of markdown-it-py in failing to convert the codeblocks.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
markdown-it-py works great but if my markdown source contains some codeblock sections such as
mermaid
anddiff
then in order for these to render properly I've got to manually add a block to the end of my html:I don't expect markdown-it-py to know to add this, but is there a way to have my required includes included automatically when
html_text = md.render(text)
is executed? Or is there an even better way?(You may correctly deduce that I am pretty basic when it comes to web; it took me a long time to realise that i needed to add these scripts and that it was not a limitation of markdown-it-py in failing to convert the codeblocks.)
Beta Was this translation helpful? Give feedback.
All reactions