Skip to content

MDX parser cannot parse HTML and React components in table cells #5702

@manovotny

Description

@manovotny

Prettier 1.15.3
Playground link

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

Input:

export const Bold = ({children}) =>
	<strong>{children}</strong>

## MDX table with HTML

| Column 1 | Column 2 |
|---|---|
| Text | <strong>Text</strong> |

## MDX table with React component

| Column 1 | Column 2 |
|---|---|
| Text | <Bold>Text</Bold> |
  
<strong>text</strong>

text
  
<Bold>text</Bold>

export default ({children}) => <section>{children}</section>

Output:

SyntaxError: Unexpected token (1:9)
> 1 | <strong>
    |         ^

Expected behavior:

MDX tables should be able to contain HTML or React components in the table cells.

If you remove the HTML or React component from the cell, it will parse correctly.

HTML in table cells does seem to work with the markdown parser, so it seems to be an mdx parser issue.

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.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