content icon indicating copy to clipboard operation
content copied to clipboard

Is it possible to use markdown-it instead of remark for Markdown rendering?

Open ElnuDev opened this issue 4 years ago • 5 comments

Is it possible to use markdown-it instead of remark? It has way more plugins available.

ElnuDev avatar Jul 29 '21 06:07 ElnuDev

Well, I managed to get markdown-it working by setting options.text to true whenever I use $content and then bypassing <nuxt-content> entirely by using @nuxtjs/markdownit and <div v-html="$md.render(content.text)"></div>. It still would be nice to be able to use other markdown renderers in <nuxt-content>, though.

ElnuDev avatar Jul 29 '21 06:07 ElnuDev

Hi @ElnuDev

In order to use Vue components in the Markdown, we need the AST and that's what remark provides.

atinux avatar Jul 29 '21 10:07 atinux

Not everybody is going to need to necessarily be able to use Vue components in Markdown in their projects, so it still would be nice to have the option to use a different renderer while still using <nuxt-content>.

ElnuDev avatar Jul 29 '21 16:07 ElnuDev

Re-opening for the nuxt content v2 that will be much simplier with different transformers supported. Cc @pi0

atinux avatar Jul 30 '21 08:07 atinux

I'm all for flexible parsing of markdown. :+1:

I'm not sure assertion motivating this is accurate though...

[markdown-it] has way more plugins available.

Remark has more plugins, a lot more: https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins, https://github.com/topics/remark-plugin, and https://www.npmjs.com/search?q=keywords%3Aremark

For support on adding specific syntax or getting a specific feature it may be worth reaching out the the remark community https://github.com/remarkjs/remark/discussions

ChristianMurphy avatar Aug 06 '21 16:08 ChristianMurphy