unplugin / unplugin-vue-markdown

Compile Markdown to Vue component
MIT License
508 stars 27 forks source link

Allow frontmatter to be exported or accessed when importing Markdown file #4

Closed lobo-tuerto closed 2 years ago

lobo-tuerto commented 2 years ago

Hello!

Is there currently a way, or how difficult would it be to have access to the frontmatter in the parent component importing the Markdown file. Usually need this info there because I use the data for the UI that surrounds the MD and in other parts of the app.

I know I could probably use something to parse the frontmatter out of the file, but since you are already making it available inside the markdown content thought I'd ask. :)

Thanks!

meteorlxy commented 2 years ago

Check the example directory:

https://github.com/antfu/vite-plugin-vue-markdown/blob/72a2860c5842bcce63280045b68bdf48ff4c8a3e/example/App.vue#L11-L14