Strikethrough serialization issue with mdast-util-to-markdown
(GFM)
#146
Unanswered
martin-lysk
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hi! Yes, probably a bug. I fixed it for emphasis/strong (standard, common mark), and that should probably also be applied to extensions (gfm strike through being the only one maintained by us!) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First of all thank you for the awesome project!
I'm using
mdast-util-to-markdown
with the GFM extensions, and I'm running into issues with roundtripping content that mixes bold (**
) and strikethrough (~
) markers.Problem
I expect the following input Markdown:
to serialize back to the same string. Instead, it gets transformed into:
That breaks the roundtrip, because the internal space is no longer escaped, and the strikethrough range has changed.
Interestingly, a similar pattern works fine when using emphasis (
_
) instead of strikethrough:Input:
Output (correct):
Reproduction
Here's a minimal script to reproduce:
Question
Is this a configuration issue, or a bug in
mdast-util-to-markdown
? It looks like[encodeInfo](https://github.com/syntax-tree/mdast-util-to-markdown/blob/main/lib/util/encode-info.js#L30)
only accounts for_
and*
, but not~
.Would love any guidance or confirmation here
Beta Was this translation helpful? Give feedback.
All reactions