markdownit-module
markdownit-module copied to clipboard
@nuxtjs/markdownit not parsing HTML tags
Version
Reproduction link
https://codesandbox.io/s/l780y229q7?fontsize=14
Steps to reproduce
Install @nuxtjs/markdownit, follow the instructions to inject text as laid out in its README, and include some HTML in the markdowned text.
What is expected ?
Markdownit will parse HTML.
What is actually happening?
HTML tags are rendered literalIy, at least, the ones I have in my text, namely span and cite.
Additional comments?
Previously I had been using vue-markdown, which did parse these tags. But I noticed in webpack analyze build that it (and other) plugins were adding huge javascript files to the build, so sought substitutes for them, and came to markdownit.
Hi Adam,
I ran into this same issue and resolved it by including html: true
in my markdownit options object (in nuxt.config.js):
markdownit: {
injected: true,
html: true,
use: [ 'markdown-it-highlightjs' ]
},
Hope this solves your problem.
Matt
Hi Matt, Yes it did, thanks for chiming in!
If anybody else is reading this, my specific site doesn't need code so Mark's use: [ 'markdown-it-highlightjs' ]
line can be omitted.
t might be worth mentioning at @nuxtjs/markdownit that the https://github.com/markdown-it/markdown-it docs list all the parameters.
Any way to give the options on the fly? like $md.render(markdown, { html: true })