Repository navigation
fix: flank strikethrough tildes like asterisk emphasis, matching GitHub - #6
Open
ahalekelly wants to merge 1 commit into
Open
ahalekelly wants to merge 1 commit into
ahalekelly wants to merge 1 commit into
Conversation
A tilde run's opener and closer checks each looked at only one side of the run, so `~$0.48 vs ~$0.65` and `~/foo and ~/bar` struck through and intraword `a~~b~~c` did not. GitHub (cmark-gfm) and micromark flank `~` like `*`; use the same left/right level comparison as the `*` branch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Opus 5.5
What/Why?
md4c decides whether a
~/~~run may open or close a strikethrough by looking at only one side of the run. GitHub (cmark-gfm) and micromark/remark-gfm use*'s flanking rule, which also weighs the other side. The mismatch strikes text GitHub leaves alone, and misses intraword strikes GitHub renders:~$0.48 vs ~$0.65 per run$0.48 vsfiles in ~/foo and ~/bar/foo and~~ not ~~nota~~b~~cbbx~y~zyy这是~~你好~~一段话你好你好Prices and
~/paths are common in coding-agent output, which is where this showed up: T3 Code's mobile app, through Enriched Markdown, struck through~$0.48 vs ~$0.65while its web client, which uses remark-gfm, didn't.This replaces the tilde branch's one-sided checks with the left/right comparison the
*branch uses. Run lengths, opener matching, and the subscript path are unchanged. The bug comes from upstream (mity#436). mity#440 refactors these rules and currently makes strikethrough underscore-like; I've suggested asterisk-like there, which is what this PR does. If upstream lands underscore-like, it would differ from this PR only on intraword runs.Testing
~$0.48 vs ~$0.65,~~ not ~~, anda~~b~~c 这是~~你好~~一段话. All three fail before this change; the full suite passes after it (1027 tests).md2html --fstrikethroughagainst GitHub's/markdownAPI (GFM mode) on 12 tilde inputs: all match.