-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Markdown nested within tags #11
Comments
This will work if you add newlines between the JSX and Markdown tags, rather than using a Here’s your code updated to do what you expect: import { Reference } from 'documentHelpers'
<Reference title='JS Reference'>
My explanation of `this` is a bit like high school chemistry; it's a nice idea but it may give an expert a heart attack.
<br/><br/>
If all you want to do is use React, it is probably good enough. But otherwise go read the details at [MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this).
</Reference> From this input, MDX 0.12.0 outputs this: import { Reference } from 'documentHelpers'
export default ({components}) => <MDXTag name="wrapper" components={components}>{`
`}<Reference title='JS Reference'>{`
`}<MDXTag name="p" components={components}>{`My explanation of `}<MDXTag name="inlineCode" components={components} parentName="p">{`this`}</MDXTag>{` is a bit like high school chemistry; it's a nice idea but it may give an expert a heart attack.`}</MDXTag>{`
`}<br/><br/>{`
`}<MDXTag name="p" components={components}>{`If all you want to do is use React, it is probably good enough. But otherwise go read the details at `}<MDXTag name="a" components={components} parentName="p" props={{"href":"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this"}}>{`MDN`}</MDXTag>{`.`}</MDXTag>{`
`}</Reference></MDXTag> |
This feels a bit unergonomic, to be honest. Conceptually, an author would probably expect the entire It doesn't help readability, either; it would be more readable to reserve double newlines for separating components/paragraphs of a snippet only, and to glob the import { Reference } from 'documentHelpers'
<Reference title='JS Reference'>
My explanation of `this` is a bit like high school chemistry; it's a nice idea but it may give an expert a heart attack.
If all you want to do is use React, it is probably good enough. But otherwise go read the details at [MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this).
</Reference>
<Reference title='foo'>
Some more text goes here.
</Reference> (I don't think the |
You may have this and I just can't figure out how to do it, but...
Is it possible to nest markdown within a JSX tag?
Here's an example of how I use this within one of my articles, with MDXC:
The text was updated successfully, but these errors were encountered: