You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
2.5.5 regression: strong emphasis adjacent to word/CJK chars fails when content starts or ends with punctuation #688
After upgrading from markdown2 2.5.4 to 2.5.5, strong emphasis sometimes stops parsing when all of these are true:
the **...** span is adjacent to alphanumeric or CJK text without surrounding spaces
the emphasized content starts or ends with punctuation, for example Chinese quotes or parentheses
On 2.5.4 these cases render correctly. On 2.5.5 the parser leaves literal ** in the output, and in longer inputs it can also emit malformed mixed HTML.
This reproduces with the default parser configuration, no extras required.
Related to #679 because it also looks like an emphasis-regression in the recent parser changes, but this one reproduces without middle-word-em and with plain markdown2.markdown(...).
Although testing this, the old strong/em behaviour was changed in #644 before being overwritten by the GFM changes in the same release cycle. So the old behaviour still wouldn't work.
I guess, since the updated behaviour of the old implementation never actually got used, since the GFM changes superseded them and fixed all the issues from that PR anyway, we could revert that change for the old implementation so that users have an option to stick with the old behaviour. @nicholasserra thoughts on this?
So basically, if we merge #690 and revert to the old behavior, they'd just need to add their own extra to disable the GFM default, and it would work as expected?
Activity
Crozzers commentedon Mar 20, 2026
Yeah, this looks like it's down to a change in the rules as to what is a valid em/strong opening/closing delimiter run.
From the minimal repro examples:
**is not a valid opening delimiter run as it's followed by punctuation, but not preceded by punctuation/whitespace as well**is not a valid closing run as it's preceeded by punctuation but not followed by punctioation/whitespace**invalid for same reason as 1For the GFM implementation we tried to follow GFM's spec, and their rules on what a left/right flanking delimiter run can consist of.
In theory you could do something like this to restore the old behaviour:
Although testing this, the old strong/em behaviour was changed in #644 before being overwritten by the GFM changes in the same release cycle. So the old behaviour still wouldn't work.
I guess, since the updated behaviour of the old implementation never actually got used, since the GFM changes superseded them and fixed all the issues from that PR anyway, we could revert that change for the old implementation so that users have an option to stick with the old behaviour.
@nicholasserra thoughts on this?
Crozzers commentedon Mar 20, 2026
Created #690 just in case with the suggested change of reverting the legacy behaviour, although open to discussion
nicholasserra commentedon Mar 26, 2026
So basically, if we merge #690 and revert to the old behavior, they'd just need to add their own extra to disable the GFM default, and it would work as expected?
Crozzers commentedon Mar 26, 2026
Yeah, pretty much
Merge pull request #690 from Crozzers/restore-original-iab-implementa…