Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Usage in Gatsby 2 #1

Open
timsuchanek opened this issue Jul 10, 2018 · 6 comments
Open

Usage in Gatsby 2 #1

timsuchanek opened this issue Jul 10, 2018 · 6 comments

Comments

@timsuchanek
Copy link

timsuchanek commented Jul 10, 2018

This is an awesome project! Thanks for creating this.

I see that you're exposing both jsx and mdxHast.

How can that be rendered in the React frontend?
As we can't use the dangerouslySetInnerHTML and need to execute the imports from the mdx source.

Would be awesome if you could show a small example how you imagine that to be used.

Thanks!

@timsuchanek
Copy link
Author

I just saw that in gatsbyjs/gatsby#312 there is a solution to this.

@silvenon
Copy link
Owner

Honestly I don’t know how to make it work properly in Gatsby v2. This transformer was my attempt to do it without the loader, but I don’t know what to expose in GraphQL to be able to render it. Any ideas would be highly appreciated.

@timsuchanek
Copy link
Author

What is the major difference that makes it hard with Gatsby v2?

@timsuchanek timsuchanek reopened this Jul 10, 2018
@timsuchanek timsuchanek changed the title Usage in gatsby Usage in Gatsby 2 Jul 10, 2018
@silvenon
Copy link
Owner

silvenon commented Jul 10, 2018

The existing solutions work in Gatsby v1, this is a WIP attempt at making it work in v2. In v1 you can set a layout, this doesn't exist in v2. I don't know how to get around that, at least not without being pretty repetitive.

@kwangkim
Copy link

avigoldman actually used gatsby-plugin-mdx which contains a mdx-loader. You may need a loader.

@silvenon
Copy link
Owner

Yeah, I’ll definitely need a loader, I found that out a while later. I’ll probably dump this project and encourage avigoldman to publish his, since it was his idea anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants