prettier / prettier/prettier

MDX 3

Open
#12,209 71 comments 115 reactions 1 assignee View on GitHub

@JounQin is already working on this.

Since Aug 4, 2022.

lang:mdx
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

MDX 2 was released on 1 Feb 2022: https://github.com/mdx-js/mdx/releases/tag/2.0.0
UPD: MDX 3 was released on 24 Oct 2023: https://github.com/mdx-js/mdx/releases/tag/3.0.0

The changes are summarised in the blog post: https://mdxjs.com/blog/v2/
UPD: https://mdxjs.com/migrating/v3/

Here is a big one for Prettier:

Originally, the format was very close to how markdown, and HTML in markdown, works. We found that the old behavior often yielded unexpected results. In version 2, we shift the format a little bit closer to how JS(X) works.

The example below is from the blog post. It is a valid MDX in v2, but Prettier 2.5.1 is unable to parse it:

Prettier 2.5.1
Playground link

--parser mdx

Input:

<div>*hi*?</div>

<div>
  # hi?
</div>

<main>
  <div>

    # hi?

  </div>
</main>

Output:

SyntaxError: Unexpected token (2:12)
  1 | <$><main>
> 2 |   <div></$>
    |            ^

Expected behavior:

No syntax error


Let’s track MDX 2 3 support here 👀

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.