mdx-js / mdx

Markdown for the component era
https://mdxjs.com
MIT License
17.71k stars 1.14k forks source link

Weird output on using Nextjs <Link> #1194

Closed khattakdev closed 4 years ago

khattakdev commented 4 years ago

Subject of the issue

Styling doesn't work if you use next/link in .mdx file without adding any normal words before <Link... Here's an example

This works input output

But this doesn't work

bug input buggy output

Your environment

Steps to reproduce

Expected behaviour

Styling should Work Properly

Actual behaviour

Styling doesn't work on that line

johno commented 4 years ago

He @eKhattak, thanks for opening up an issue! This is a result of the v1 parser thinking that the entire block is JSX when a line begins with JSX. You'd need to add a space before your Link to trigger the inline tokenization. This is something that will be fixed in v2 (#1077).

Since it's not something we plan on fixing in v1, and is fixed in v2 (which has a canary release), I'm going to close this issue.