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

Allow using vue components

Open gotenxds opened this issue 5 years ago • 2 comments

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

gotenxds avatar Jun 02 '20 09:06 gotenxds

Hi @gotenxds

Is this issue for markdownit module?

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

atinux avatar Oct 01 '20 10:10 atinux

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)

gotenxds avatar Oct 01 '20 11:10 gotenxds