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 formatter adding semicolon to JSX code blocks

See original GitHub issue

Prettier 1.15.1 (Seems like the playground doesn’t support MDX yet?)

# Options (if any):
Default options

Input: test.mdx:

This is a MDX file!

```jsx
<Button />
``` 

Output:

This is a MDX file!

```jsx
<Button />;
```

Expected behavior:

This is a MDX file!

```jsx
<Button />
```

This seems related to https://github.com/prettier/prettier/issues/3196 and https://github.com/prettier/prettier/pull/3330.


Thanks for the help!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
danoccommented, Nov 7, 2018

Ah, yes. Sorry if that wasn’t originally clear.

1reaction
duailibecommented, Nov 7, 2018

Your code inserts a JSX-formatted code block instead of rendering the JSX

That’s exactly what @danoc described in the issue, and Prettier is inserting a semicolon

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options - Prettier
Prettier ships with a handful of format options. ... false - Only add semicolons at the beginning of lines that may introduce ASI...
Read more >
Syntax highlighting - MDX
This guide explores how to apply syntax highlighting to code blocks. MDX supports standard markdown syntax (CommonMark).
Read more >
How to add semicolon to the end of the line in visual studio code
Now there is an extension called Colonize: Shift + Enter Insert semicolon at the end of line and continue on the same line....
Read more >
Guide to Writing MDX and Markdown | Chicago Docs
Overview. The official MDX site describes MDX as 'an authorable format that lets you seamlessly write JSX in your Markdown documents.
Read more >
prettierx | Yarn - Package Manager
prettierX - a less opinionated fork of Prettier ... An unofficial fork of the Prettier code formatter, intended to provide some additional options...
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