markdownit-module icon indicating copy to clipboard operation
markdownit-module copied to clipboard

@nuxtjs/markdownit not parsing HTML tags

Open adamkhan opened this issue 5 years ago • 3 comments

Version

1.2.3

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.

This bug report is available on Nuxt community (#c155)

adamkhan avatar Mar 13 '19 10:03 adamkhan

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

mthelm85 avatar Mar 17 '19 22:03 mthelm85

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.

adamkhan avatar Mar 18 '19 11:03 adamkhan

Any way to give the options on the fly? like $md.render(markdown, { html: true })

alitnk avatar Jun 06 '21 05:06 alitnk