mdx-js/mdx

@mdx-js/runtime: Empty line causes error

Closed this issue · 2 comments

Example: https://codesandbox.io/s/x913608y8o

If you remove the empty line @ 20, everything works.

Not sure if maybe I'm missing something here.

Edit: Also seems to throw an error if <h2 style={{"textAlign":"right"}}>On the right</h2> is directly after ### Hi instead of <Rand />.

Just to narrow the bug down for anyone curious to solve it. This MDX:

<div style={{ color: 'tomato' }} />

compiles normally. However, if I change the tag to (apparently) any of the tags natively supported by Markdown:

<p style={{ color: 'tomato' }} />

it compiles to this:

<MDXTag
  name="p"
  components={components}
>
  {`<p style={{ color: 'tomato' }} />`}
</MDXTag>

This is the root of the problem. The syntax error happens as soon as you add children to that paragraph. It's a bug in @mdx-js/mdx, not runtime.

Probably the same problem as #222.

johno commented

Thanks for opening up the issue! I'm going to close this in favor of #195 since it covers the same parsing issue.