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

"<" in Markdown Code element is producing an error #1424

Closed
Exelord opened this issue Jan 1, 2021 · 4 comments
Closed

"<" in Markdown Code element is producing an error #1424

Exelord opened this issue Jan 1, 2021 · 4 comments
Labels
🙋 no/question This does not need any changes

Comments

@Exelord
Copy link

Exelord commented Jan 1, 2021

Subject of the issue

"<" in Markdown Code element is producing an error. Whenever the HTML element has a nested Markdown CODE, it is failing if it contains "<" Mark.

Your environment

MDX Playground
https://mdxjs.com/playground/

Steps to reproduce

Paste in playground:

<h1>`for (let i = 0; i < 9; i++)`</h1>

Expected behaviour

No error, it should render just fine

Actual behaviour

Screen Shot 2021-01-01 at 19 21 36

@Exelord Exelord added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Jan 1, 2021
@ChristianMurphy
Copy link
Member

ChristianMurphy commented Jan 1, 2021

@Exelord your example doesn't have a code element.
MDX needs a newline to go from a JSX block back to a markdown block.
See this for an example of how the content is parsed https://astexplorer.net/#/gist/46549a94f05978e6f75bd6c892d56419/561c25a9b1253264b63637a329289ee088f1549c

the syntax you are looking for is

<h1>

`for (let i = 0; i < 9; i++)`

</h1>

@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 Jan 1, 2021
@wooorm
Copy link
Member

wooorm commented Jan 1, 2021

V2 would make this easier too btw! There your code should work

@Exelord
Copy link
Author

Exelord commented Jan 5, 2021

I see... This is super frustrating then. My case is to have content like this:

<h1>
  Hey this is an inline code: `some text`
</h1>

And I expected the content of the element to be parsed as markdown. Is there any doc mentioning the new line wrapper? For editors, this can bring a lot of bugs as I guess this is not a natural way of writing templates.

@wooorm
Copy link
Member

wooorm commented Jan 5, 2021

#1039

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

3 participants