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

Passing props in code blocks to component #76

Closed
jeroenransijn opened this issue Aug 23, 2018 · 6 comments
Closed

Passing props in code blocks to component #76

jeroenransijn opened this issue Aug 23, 2018 · 6 comments

Comments

@jeroenransijn
Copy link

The following markdown spec mentions being able to use props (?) inside of code blocks: https://github.github.com/gfm/#indented-code-blocks. I am not sure if this would a issue we can fix within gatsby-mdx.

image

@ChristopherBiscardi
Copy link
Owner

I really want this too. Will look into it to see if it's something we can enable here. My suspicion is that we'll have to PR to mdx itself to support it though.

@ChristopherBiscardi
Copy link
Owner

Looks like it's going to require this PR to get merged -- remarkjs/remark#345 -- since mdx uses remark-parse, whose AST is mdast (and the mdast description PR was merged).

@ChristopherBiscardi
Copy link
Owner

Might be able to work around since apparently we could do the infostring splitting ourselves for now -- mdx-js/specification#17 (comment)

@ChristopherBiscardi
Copy link
Owner

we lose the inforstring in between mdPlugins and hastPlugins in mdx core: https://codesandbox.io/s/3y4wymyj75

I believe it's due to this line in mdast-util-tohast -- https://github.com/syntax-tree/mdast-util-to-hast/blob/master/lib/handlers/code.js#L15

@ChristopherBiscardi
Copy link
Owner

We need this: syntax-tree/mdast-util-to-hast#24

and then we should add handling to MDX core to turn the meta string into props

@ChristopherBiscardi
Copy link
Owner

Just waiting on an MDX core release now. Should be available in any @mdx-js/mdx version > 0.15.2 but I don't think there's anything left to do in gatsby-mdx so going to close this.

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

No branches or pull requests

2 participants