-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global <MDX> or md`` function support #736
Comments
Right now you can achieve this with blank lines after the opening and closing tags (as specified by CommonMark): <AlertComponent>
# Hello, world!
</AlertComponent> The blank lines "reopen" markdown parsing. Does this fit into what you're wanting to achieve? |
@johno Thanks for the reply! <Button/> md`#hello` Using a function seems to be more flexible, and also what if I want to do some other things or pass more markdown as props to more complex component ? Like so: <Model head={md`#head`} body={md`#body`}>
</Model> |
Hmm, yeah I see. 👍 We've discussed this before (though mainly as a Also, if anyone has thoughts on how this could best be achieved/implemented please chime in! |
I think If we’re going with that, then |
Really appreciate the suggestion but with v2 we’re going to support much more powerful interleaving but no inline MDX support for expressions. Though this should be achievable with a Babel macro. |
I'm REALLY struggling to make something like the below work: import data from "./changelog.json";
From: {data.from}
To: {data.to}
Updated: {data.updated}
## Releases
{data.releases.map((release) => (
<div>
## ${release.tag}
Date: ${release.date}
</div>
))} But I just can't make the contents generated by the map be parsed as markdown. I would super appreciate any ideas. |
This comment has been minimized.
This comment has been minimized.
You can create 2 MDX files. {/* release.mdx */}
<div>
## ${props.release.tag}
Date: ${props.release.date}
</div> import data from "./changelog.json";
import Release from './release.mdx';
From: {data.from}
To: {data.to}
Updated: {data.updated}
## Releases
{data.releases.map((release) => <Release release={release} />)} |
Oh I didn't need the And it worked. SUPER thank you @remcohaszing! |
Subject of the feature
I have known mdx has supported
global component
, like so:Is there a way to support
global function
?Problem
I want to create a markdown parse function so that I can parse markdown anywhere in mdx.
Likes so:
And in a markdown
But now, I can only use the tag format, like so:
It is not convenient!
Is there a change? Thanks!
Expected behavior
In markdown:
The text was updated successfully, but these errors were encountered: