I want to render Markdown with JavaScript using the markdown-it library from here: https://github.com/markdown-it/markdown-it
I included markdown it from the CDN with this:
<script type="text/javascript" src="https://cdn.jsdelivr.net/markdown-it/8.2.2/markdown-it.min.js"></script>
Then I followed the instructions in the README, here is the relevant part of my code:
var md = window.markdownit();
document.getElementByID("content").innerHTML = md.render("# Header");
However, it isn't working and I am getting this error in the console:
Uncaught TypeError: e.src is undefined
exports https://cdn.jsdelivr.net/markdown-it/8.2.2/markdown-it.min.js:3
process https://cdn.jsdelivr.net/markdown-it/8.2.2/markdown-it.min.js:2
parse https://cdn.jsdelivr.net/markdown-it/8.2.2/markdown-it.min.js:2
render https://cdn.jsdelivr.net/markdown-it/8.2.2/markdown-it.min.js:2
<anonymous> http://localhost/script.js:110
How do I fix this issue?
EDIT: I decided to use markdown-js instead. I'm leaving this question in case it is useful for somebody else.