nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.07k stars 623 forks source link

Support content in MDX format #2498

Open septatrix opened 8 months ago

septatrix commented 8 months ago

Is your feature request related to a problem? Please describe

Other frameworks for authoring static content such as Docusaurus, Vuepress/Vitepress, or Astro.JS use either MDX or a format that is very similar to it. The biggest difference from the Markdown extensions Nuxt Content uses is that components are written using angle brackets (<>...</>) instead of double colons :: ... ::. This makes transitioning to Nuxt more annoying, especially as a simple regex is not sufficient. (Nesting is handled differently, and both Docusaurus and Vitepress support callout containers using triple colons which would conflict.)

Describe the solution you'd like

Support mdx files in addition to md files.

Describe alternatives you've considered

Update the current parser to use angle brackets instead of colons. This would certainly work too (and e.g. Vitepress still uses the .md extension though it is very close to MDX) but would break existing sites so it should only be done on a major version update. Alternatively this could be made configurable but using .mdx files seems like a simpler solution for now.

Additional context

I do not know the exact flow in which markdown is parsed, transformed and rendered in content though there exists a remark-mdx plugin. However, I am not sure if it is easily injectable into Nuxt Content based on the order in which all other transformations/plugins are executed.

nobkd commented 8 months ago

You can use global components (not auto-imported I think...) with HTML syntax in your Markdown, just as you would use them in Vue files. See https://github.com/nuxt/content/issues/2248#issuecomment-1696080218 You only have to make sure to not use self-closing tags, as they currently do not work.

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

stefanprobst commented 3 weeks ago

still interested in this.