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.

Unnecessary <p>...</p>s are inserted to every top-level HTML literal

See original GitHub issue

MDX (2.0.0-next.8) adds unnecessary p layers as

Input

<h1>Title</h1>

<p>Text</p>

Output

<h1><p>Title</p></h1>

<p><p>Text</p></p>

This will break styles and some React components that take children.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lunelsoncommented, Feb 17, 2021

IMO this behaviour should not require a plugin to fix it, it shouldn’t happen at all. @wooorm are you saying that this is correct parsing?

1reaction
rnarkkcommented, Mar 19, 2021

Seems the<p>- inserting rule has changed since 2.0.0-next.9.

PS

No, the truth is that the parser has moved to mdast-util-mdx-jsx and the names of nodes of AST have also changed:

  • mdxBlockElement to mdxJsxFlowElement
  • mdxAttribute to mdxJsxAttribute
Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Standard
Presentational markup tends to be much more redundant, and thus results in ... A literal U+0050 LATIN CAPITAL LETTER P character followed by...
Read more >
PythonTA Checks
This error occurs when code statements are placed in the top level. The type of statements allowed in the top level are imports,...
Read more >
HTML 5.3
Abstract. This specification defines the 5th major version, third minor revision of the core language of the World Wide Web: the Hypertext ...
Read more >
CL-WHO - Yet another Lisp markup language
If prologue is T the prologue string is the value of *PROLOGUE* . CL-WHO will usually try not to insert any unnecessary whitespace...
Read more >
Chapter 2 Manipulate HTML tags from R with {htmltools}
Inside the function call, all named elements become attributes, whereas unnamed elements become children. In some cases, tags may have empty attributes like...
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