Closed vnphanquang closed 3 weeks ago
Thanks for the repro!
It’s a bit of a weird case: p
in td
, as that isn’t allowed in GFM markdown itself. But it’s fine in HTML.
Anyway, good to add a guard to that check indeed!
Thanks a lot @wooorm. That was super quick :tada:
Initial checklist
Affected packages and versions
mdast-util-to-markdown@2.1.1
, possiblymdast-util-gfm@3.0.0
Link to runnable example
https://github.com/vnphanquang/repro-mdast-util-to-markdown
Steps to reproduce
Reproduction
node index.js
More information
Given this input:
I suspect the key troubling markup is at
<em><strong>Paragraph 2</strong></em>
. However, it does require an odd combination of being inside atable
and also having multiple paragraphs intd
to trigger the observed error.From my test, skipping...
https://github.com/syntax-tree/mdast-util-to-markdown/blob/ec4eaf0cb0065afb755494403624edc8940ed333/lib/util/container-phrasing.js#L106
...produces a successful output. That is:
However, I lack knowledge of the codebase to determine whether this change produces other false positive. Happy to open PR if given direction.
Expected behavior
Should output
output.md
Actual behavior
Error thrown as observed in console:
Affected runtime and version
node@22.11.0
Affected package manager and version
pnpm@9.12.3
Affected OS and version
Linux 6.6 Arch Linux
Build and bundle tools
other (please specify in steps to reproduce)