Closed tamlok closed 7 years ago
It's been two months since this was asked but it took me a bit to figure this out too. Here's the approach that worked for me.
In your HTML code, load first load both markdown-it
and markdown-it-mathjax
. Then, when you call markdownit()
, append the use
method with markdownitMathjax()
. Thus your code might look something like so:
<script src="your/path/markdown-it.js"></script>
<script src="your/path/markdown-it-mathjax.js"></script>
<script>
var md = markdownit().use(markdownitMathjax());
var result = md.render(input_text);
</script>
This does not seem to work, there is some extra trick here needed.
It seems like it requires this also of course:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
@Ciantic I'm not quite sure from your second comment if you've got it resolved or not. Either way, you can view my complete working example here: https://marksmath.org/temp/markdown-it-test/
HTH!
Hi, can I just download the
markdown-it-mathjax.js
file and reference it directly from browser side? Otherwise, could you help to build it and share it in adist
folder like other plugins do? Thanks!