nuxt-community / markdownit-module

Markdownit for Nuxt 2
MIT License
48 stars 11 forks source link

Allow using vue components #4

Open gotenxds opened 4 years ago

gotenxds commented 4 years ago

Hello I'm looking for a way to render md data from my database on the fly, I have some complex data and having the ability to use vue components in the markdown like in nuxt-content would be great, is there any way of achieving that

atinux commented 4 years ago

Hi @gotenxds

Is this issue for markdownit module?

If so, could you show an example of what you are trying to achieve?

gotenxds commented 4 years ago

Hi @Atinux This was originally opened for markdown-it, I've sinced moved on to @nuxt/markdown

The idea is to use vue components in markdown much like in nuxt/content but render it in runtime where the data is unknown.

In my use case there are a lot of small text snippets (10-100 lines of text at most) formated using markdown and stored in the DB as a plain string.

The idea would be to fetch this string and display it using md.toMarkup(data) while having the ability to include vue components in the markdown for added functionality, that is for example, call functions or events, veutify components and so on.

In my experiments, I managed to do this to a point using the vue compiler and registering specific components (as auto-detection is not possible here)