Skip to content

MDX parser cannot incorrectly parses React components used within markdown syntax in paragraphs #5781

@manovotny

Description

@manovotny

This isn't a regression in 1.16.0. I was doing this before today's release.

Prettier 1.16.0
Playground link

--parser mdx
--no-semi
--single-quote

Input:

export const Bolded = () =>
	<strong>bolded text</strong>

This is an example of a component _being used in some italic markdown with some <Bolded />, 
and as you can see_ once you close the italics, it will break incorrectly when prettier formats it.

Output:

export const Bolded = () => <strong>bolded text</strong>

This is an example of a component _being used in some italic markdown with some

<Bolded />,
and as you can see_ once you close the italics, it will break incorrectly when prettier formats it.

Rendered:

As you can see, when it adds a completely blank line before the component, it will cause the italics to break and format the markdown / MDX incorrectly.

screen shot 2019-01-20 at 4 25 17 pm

Expected behavior:

The completely blank line should not be there and the paragraph should read correctly and unbroken.

screen shot 2019-01-20 at 4 26 59 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:mdxIssues affecting the MDX extension to Markdown (not general Markdown issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions