Skip to content
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 content of custom MDX component isn't parsed if empty line isn't present #1312

Closed
jonathanlinat opened this issue Oct 27, 2020 · 1 comment
Labels
🙋 no/question This does not need any changes

Comments

@jonathanlinat
Copy link

jonathanlinat commented Oct 27, 2020

Subject of the issue

Depending how assigned child is, Markdown parsing breaks in a specific case.

Your environment

Actual behavior

I have a custom MDX component called MessageBox. This is basically a component that renders assigned child.

In that case, it doesn't work.

<MessageBox>
  This tutorial is designed for people who prefer to **learn by doing**. If you prefer learning concepts from the ground up, check out our [step-by-step guide](https://reactjs.org/docs/hello-world.html). You might find this tutorial and the guide complementary to each other.
</MessageBox>

image

In that one, it does (??)

<MessageBox>

  This tutorial is designed for people who prefer to **learn by doing**. If you prefer learning concepts from the ground up, check out our [step-by-step guide](https://reactjs.org/docs/hello-world.html). You might find this tutorial and the guide complementary to each other.
</MessageBox>

image

This is the component source code:

const MessageBox = (props) => (
  <div>{props.children}</div>
)

Expected behaviour

I don't want to have to add an empty line immediately after the first tag in order to have Markdown parsed as expected.

@jonathanlinat jonathanlinat added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Oct 27, 2020
@ChristianMurphy ChristianMurphy added 🙋 no/question This does not need any changes and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Oct 27, 2020
@ChristianMurphy
Copy link
Member

This isn't a bug, this is how Markdown/JSX interleaving works in version 1.
MDX 2 (#1041) adds support for some types of inline interleaving (no newline required) of markdown in jsx (#628).
Give version 2 a try and see if it fits your needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes
Development

No branches or pull requests

2 participants