Mdx: Need to fetch markdown from remote source via getInitialProps NextJs

Created on 20 Sep 2019  路  2Comments  路  Source: mdx-js/mdx

I'm trying to retrieve a markdown file from a remote source using getInitialProps. I am able to do this, however I am unable to use the async API to transpile it to JSX. I am just receiving issues about the fs module.

Any guidance on this would be greatly appreciated.

馃憖 areexternal

Most helpful comment

I just figured it out :-) See https://github.com/millette/t3

Note that I (temporalely) forked mdx-runtime to use buble-jsx-only instead of buble but it works with either.

All 2 comments

I just figured it out :-) See https://github.com/millette/t3

Note that I (temporalely) forked mdx-runtime to use buble-jsx-only instead of buble but it works with either.

@Kinbaum Fetching remote Markdown is something that an application I am working on needed to do as well. Using @mdx/runtime as the example posted by @millette is the same approach we ended up using and it has been effective for returning compiled JSX to react for render to the page.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brennj picture brennj  路  14Comments

adamwathan picture adamwathan  路  12Comments

kylegach picture kylegach  路  22Comments

ChristianMurphy picture ChristianMurphy  路  13Comments

slorber picture slorber  路  19Comments