Mdx: "<" in Markdown Code element is producing an error

Created on 1 Jan 2021  路  4Comments  路  Source: mdx-js/mdx

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

馃檵 typquestion

Most helpful comment

All 4 comments

@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

````markdown

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

````

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

egoist picture egoist  路  5Comments

mAAdhaTTah picture mAAdhaTTah  路  4Comments

francisfuzz picture francisfuzz  路  4Comments

deligent-ant picture deligent-ant  路  3Comments

riceboyler picture riceboyler  路  3Comments