Sandros94 / nuxt-markdown-render

A Nuxt wrapper for the popular markdown-it.
https://www.npmjs.com/package/nuxt-markdown-render
MIT License
7 stars 1 forks source link

mdc support #2

Closed Sandros94 closed 5 months ago

Sandros94 commented 5 months ago

In the main readme I do reference to antfu's markdown-it-mdc work, but I don't actually understand how to make it to work, although the plugin is correctly loaded and the tag rendered in html code.

Sandros94 commented 5 months ago

The main issue was that I was relying on using innerHTML inside the rendering function. This caused the inhability to vue to control components.

[...]

I finally realized that there are two separate steps. This plugin gives the syntax for mdc-style components in Markdown, but they will not render until I compile the markdown strings to Vue components. I'll research how to do that.

[...]

Following this comment on markdown-it-mdc my understanding is that I first need that plugin to parse the md text and extrapolate the vue component logic, but then use vue to compile that component and actually render it.

Hopefully this is the right approach and only time or people will bring up potential issues with this approach.