Mdx: Add Nuxt module for MDX

Created on 14 May 2020  路  4Comments  路  Source: mdx-js/mdx

Add a Nuxt.js module to make MDX usage in Nuxt convenient in Nuxt.js

Currently I'm using MDX with Nuxt. The doesn't come without the usual gymnastics of having to create a custom router to load the MDX files for pages.

Problem

Nuxt's builder will ignore all non .vue files in the pages directory by default. In order to make this more convenient, we need to load the files programmatically inside a module.

After exploring this extensively I found that this cannot be done easily in user-land.

Expected behavior

The outcome should look something like the image shown below. MDX files are loaded seamlessly into Nuxt's builder.

image

Alternatives

What are the alternative solutions? Please describe what else you have considered?

help wanted 馃檹

All 4 comments

Hey, @wooorm !

Was able whip up something for this. Will be submitting a PR to the nuxt-community organization on Github for this. We can link to it in the README perhaps? Any thoughts?

There's the source code: https://github.com/codebender828/mdx-module

I really have no experience with nuxt and almost none with react/vue, so I鈥檓 not the best person to speak on this.

Unfortunately we don鈥檛 yet list integrations on the readme. I think we should do that. Or maybe a new section on the website, under Getting Started, for Vue?

Yes. An easy way for people looking to get started with other integrations will be beneficial. I would suggest a page in the docs and in the readme. 馃檹

@codebender828 Is this something you could work on? Or someone else willing to submit a PR listing integrations in the readme?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

silvenon picture silvenon  路  4Comments

lex111 picture lex111  路  4Comments

dioptre picture dioptre  路  3Comments

deligent-ant picture deligent-ant  路  3Comments

laurieontech picture laurieontech  路  3Comments