question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Markdown in nested HTML

See original GitHub issue

Subject of the issue

Currently, MDX crashes on Markdown in nested HTML. Example:

<div>

* list

</div>

Works.

<div>
  <div>

  * list

  </div>
</div>

Crashes! Resulting in something like:

error UNHANDLED REJECTION


  SyntaxError: unknown: Expected corresponding JSX closing tag for <MDXTag> (30:0)
    28 | <MDXTag name="li" components={components} parentName="ul">
    29 | <MDXTag name="p" components={components} parentName="li">{`list`}</MDXTag>
  > 30 | </div>
       | ^
    31 | </MDXTag>
    32 | </MDXTag>
    33 | </div>

This makes it impossible to use Markdown in a table, since you need to nest some table, tr, and td tags in HTML.

Your environment

Tried with the create-react-app example:

    "mdx.macro": "^0.2.8",
    "react": "^16.8.4",
    "react-dom": "^16.8.4",
    "react-scripts": "2.1.8"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
morloycommented, Apr 26, 2019

@Undistraction I think that’s already supported. But you need to add a space:

<Example>

# Example
</Example>
2reactions
Undistractioncommented, Apr 26, 2019

@johno Do you plan to support Markdown in only HTML:

<div>
# Example
</div>

or inside a Component?

<Example>
# Example
</Example>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown in nested divs not being processed - Stack Overflow
However, the markdown isn't being processed here. It doesn't seem to work in nested HTML blocks. Single level blocks will work: <div markdown= ......
Read more >
Markdown Tutorial - Nested Lists - CommonMark
To nest one list within another, indent each item in the sublist by four spaces. You can also nest other elements like paragraphs,...
Read more >
Basic Syntax - Markdown Guide
If your Markdown application supports HTML, you can use the <br> HTML tag. ... Indent one or more items to create a nested...
Read more >
Markdown in nested shortcodes - support - HUGO
Runs the provided string through the Markdown processor. ... Currently I rewrote my templates and shortcodes with more HTML to accommodate this limitation....
Read more >
Little Stuff about Markdown I Always Forget and have to Google
There is no concept of a <div> in Markdown syntax (or most other structural HTML elements), except that Markdown supports HTML so you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found