Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX followed by markdown link does not render link as HTML #1571

Closed
Farrser opened this issue Jun 2, 2021 · 1 comment
Closed

JSX followed by markdown link does not render link as HTML #1571

Farrser opened this issue Jun 2, 2021 · 1 comment
Labels
🙋 no/question This does not need any changes 💎 v1 Issues related to v1

Comments

@Farrser
Copy link

Farrser commented Jun 2, 2021

JSX followed by markdown link does not render link as HTML

Using a <jsx>tag</jsx> followed by a [link](../path) does not render the link as HTML and instead outputs the raw markdown.

Your environment

  • OS: Mac 10.14.6
  • Packages: docusaurus 2.0.0-alpha.73

Steps to reproduce

  1. Go to the mdx playground
  2. Try the following line <Hello/> [link](../path)
  3. The raw link is output [link](../path)

Interestingly, putting text before the JSX fixes it e.g. Text <Hello/> [link](../path)

Expected behaviour

The link should be output as an HTML <a> tag

Actual behaviour

The raw markdown is output

Screenshot from playground:
image

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Jun 2, 2021

In MDX 1 this behavior is intended.
If the line starts with JSX content, it is assumed the whole line is JSX, and no wrapping paragraph is added.
If the line starts with Markdown/plaintext, it is assumed the line is mixed Markdown/JSX and a wrapping paragraph is added.

This behavior changes in MDX version 2, thanks to #628
And you can try out the new behavior today in the v2 release line https://codesandbox.io/s/affectionate-bohr-90e2p
The will be available in docusaurus when facebook/docusaurus#4029 is addressed.

@ChristianMurphy ChristianMurphy added 💎 v1 Issues related to v1 🙋 no/question This does not need any changes and removed 🐛 type/bug This is a problem 🔍 status/open labels Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes 💎 v1 Issues related to v1
Development

No branches or pull requests

2 participants