Skip to content

Contents of <div> element in .mdx file is wrapped in <p>, is this by design? #2194

Discussion options

You must be logged in to vote

Sorry you ran into some confusion @gregorfelkar.
This behavior is expected and follows the rules of Markdown and JSX.
If you haven't read https://mdxjs.com/docs/what-is-mdx/ yet, start here, then continue with the following.

MDX is Markdown + JSX.
There is no HTML syntax parsing involved, and using HTML's line break and block definitions as a mental model will cause further confusion.

What is most relevant here are markdown's content rules, the rule of thumb there, if things are on a single line and can be wrapped by other things, they are inline content.
If things cross multiple lines and cannot be wrapped by other things, they are a block.

The following is inline

<div className="no-issue">

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@gregorfelkar
Comment options

Comment options

You must be logged in to vote
1 reply
@gregorfelkar
Comment options

Answer selected by gregorfelkar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants