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.

RFC: MDX v2 block parsing

See original GitHub issue

Currently, as implemented in MDX v2, the block parser begins a paragraph inside lines that begin with a component. This was initially intended, but I’m not sure it makes sense in practice. It results in some unexpected behavior (IMO).

Consider the following MDX:

# Hello, world!

<Button>Weee</Button>

We end up with:

<h1>Hello, world!</h1>

<Button>
  <p>Weee</p>
</Button>

In v1 we result in:

<h1>Hello, world!</h1>

<Button>Weee</Button>

In v1, you could work around wanting a paragraph with something like:

# Hello, world!

<p>
  <Button>Weee</Button>
</p>

Another unexpected case is directly inlining your paragraph tag for the block:

# Hello, world!

<p>
  Weee
</p>

Which results in:

<h1>Hello, world!</h1>

<p>
  <p>Weee</p>
</p>

Why might you want to do that? It might make sense if your paragraph in MDXProvider has a styling API and you want to make a one off tweak: <p color='red'>Weeee</p>.


tl;dr I’m thinking that it likely makes the most sense to not continue block parsing inside blocks which begin with JSX. It’s more flexible that way.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (13 by maintainers)

github_iconTop GitHub Comments

4reactions
wooormcommented, Aug 24, 2020

For now, in the beta, you can use braces too I believe, as they “exit” markdown: {<Buton>x</Buton>} or <Buton>{x}</Buton>

2reactions
wooormcommented, Dec 18, 2020

Hi all! I’m going to close this as it landed on the main, the (now default) branch we’re using to gear up to the MDX@2 release.

The reason is so that it’s more clear which issues still need to be solved already and don’t require further work.

Expect another next release soonish, which might include it, or maybe it’s already released as a beta!

For more info, see https://github.com/mdx-js/mdx/issues/1041.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MDX Parser - Confluence Mobile - Support Wiki
The MDX Parser can be installed on the client and the server side. ... is called which does the parsing on the client...
Read more >
How to resolve MDX Statement error. Error occurred when ...
It is possible that the RFC failes due to the OS reching the limit on maximum number of processes. First need to check...
Read more >
RFC 6716: Definition of the Opus Audio Codec
1. Bitrate Opus supports all bitrates from 6 kbit/s to 510 kbit/s. · 2. Number of Channels (Mono/Stereo) Opus can transmit either mono...
Read more >
Gatsby Changelog | 5.3.0
RFC for changes in sort and aggregation fields in Gatsby GraphQL Schema; Release Candidate for gatsby-plugin-mdx v4 - Support for MDX v2 and...
Read more >
MDX (@mdx_js) / Twitter
🔸gatsby-plugin-mdx v4 — full compatibility with MDX 2! 🔸New RFC for Slices API. Faster deploys for changes to content blocks used on many...
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