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.

MDX parsing error for components that are not self-closing (fixed, but not yet released)

See original GitHub issue

Prettier 1.19.1 Playground link

--parser mdx

Input:

---
title: Home
---

import { Link } from "gatsby"

# Page title

Some paragraph

<Link to="/somewhere-else/">Go somewhere else</Link>
  

Output:

SyntaxError: Void elements do not have end tags "Link" (1:46)
> 1 | ---
    |    ^
  2 | title: Home
  3 | ---
  4 | 

Expected behavior:

This should not throw an error as it is valid MDX.

The following does not throw an error (Playground link):

<Link to="/somewhere-else/" label="Go somewhere else" />

It seems that the error is coming from the component not being self-closing.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
thorn0commented, Jan 9, 2020

@JDansercoer Hopefully, Prettier 2.0 will be out in January. Follow #6888 for details. As for installing from GitHub, see https://docs.npmjs.com/cli/install.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting MDX
This article goes through several common problems and errors that might occur when using MDX.
Read more >
eslint-mdx: Versions | Openbase
Full version history for eslint-mdx including change logs. ... release-v1 ... 1ef8b2c fix: adjacent self-closing jsx nodes parsing error - close #138 ...
Read more >
Gatsby Changelog | 5.3.0
In PR #36623 we fixed this behavior and any node changes (either by changing local files or through webhook updates) will be reflected...
Read more >
Support MDX file format : WEB-32599 - YouTrack - JetBrains
With this configuration, WebStorm uses the grammar described in the TexMate bundle to parse and highlight the code. For WebStorm, it's not a...
Read more >
gatsby-plugin-mdx
gatsby-plugin-mdx is the official integration for using MDX with Gatsby. MDX is markdown for the component era. It lets you write JSX…
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