Skip to content

fix(mrkdwn): keep unmatched __ and ~~ delimiters literal - #6

Merged
codesoda merged 1 commit into
mainfrom
fix/mrkdwn-unmatched-delimiters
Sep 8, 2026
Merged

fix(mrkdwn): keep unmatched __ and ~~ delimiters literal#6
codesoda merged 1 commit into
mainfrom
fix/mrkdwn-unmatched-delimiters

Conversation

@codesoda

@codesoda codesoda commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the Sentry review on #3. The unmatched-** fix landed there, but the same bug exists for double underscore (__) and double tilde (~~) — flagged by Sentry after #3 merged.

An unmatched __/~~ emitted one literal marker then re-processed the second character with the single-delimiter logic, which greedily found the next _/~ and formed a spurious italic/strikethrough span:

  • __foo_bar_ (literal) + _foo_ (italic) + bar

Fix

Emit both markers literally and advance by two, exactly as the ** branch already does. __foo_bar and ~~a~b now stay literal; matched __bold__/~~strike~~ still convert.

Regression test: unmatched_double_underscore_and_tilde_stay_literal.

🤖 Generated with pi


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Follow-up to the #3 review. The unmatched-** fix wasn't applied to the double
underscore and double tilde branches: an unmatched `__`/`~~` emitted one
literal marker then re-parsed the second as a single-delimiter opener, greedily
forming a spurious italic/strikethrough span (e.g. `__foo_bar` -> `_ + _foo_ +
bar`). Emit both markers literally and advance by two, matching the `**` fix.

Adds regression test unmatched_double_underscore_and_tilde_stay_literal.
@codesoda
codesoda merged commit a6bacd6 into main Sep 8, 2026
9 checks passed
@codesoda
codesoda deleted the fix/mrkdwn-unmatched-delimiters branch September 8, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant