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

Prettier adds extra new lines when run twice on mdx with inline tags #6274

Open
emckay opened this issue Jul 4, 2019 · 2 comments
Open

Prettier adds extra new lines when run twice on mdx with inline tags #6274

emckay opened this issue Jul 4, 2019 · 2 comments
Labels
area:idempotency Issues with re-printing Prettier’s output lang:mdx Issues affecting the MDX extension to Markdown (not general Markdown issues) type:bug Issues identifying ugly output, or a defect in the program

Comments

@emckay
Copy link

emckay commented Jul 4, 2019

Prettier 1.18.2
Playground link

--parser mdx
--prose-wrap always

Input:

This is a fairly long sentence with an html tag near the <dfn data-title="testing">end</dfn> and then some additional words.

Output:

This is a fairly long sentence with an html tag near the
<dfn data-title="testing">end</dfn> and then some additional words.

Second Output:

SyntaxError: Unexpected token (1:37)
> 1 | <dfn data-title="testing">end</dfn> and then some additional words.
    |                                     ^

Expected behavior:

The output from this sample might be fine, but after prettier runs on it again, it throws an error in the playground: Playground link

This seems to be an error specific to the playground. Locally, when I run prettier@1.18.2 twice over the sample text, this is what I get:

$ yarn list --pattern prettier
yarn list v1.12.3
└─ prettier@1.18.2
Done in 0.84s.
$ echo "This is a fairly long sentence with an html tag near the <dfn data-title="testing">end</dfn> and then some additional words." | yarn run --silent prettier --parser mdx --prose-wrap always | yarn run --silent prettier --parser mdx --prose-wrap always
This is a fairly long sentence with an html tag near the

<dfn data-title=testing>end</dfn> and then some additional words.

The extra new line causes the markdown parser to break up what was originally a single line into two paragraphs.

@lydell lydell added area:idempotency Issues with re-printing Prettier’s output lang:mdx Issues affecting the MDX extension to Markdown (not general Markdown issues) type:bug Issues identifying ugly output, or a defect in the program labels Jul 4, 2019
@gutenye
Copy link

gutenye commented Jul 5, 2022

@fisker This bug is annoying, any plans to fix it?

@kachkaev
Copy link
Member

kachkaev commented Jul 5, 2022

Worth tracking #12209 (help wanted!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:idempotency Issues with re-printing Prettier’s output lang:mdx Issues affecting the MDX extension to Markdown (not general Markdown issues) type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

4 participants