fix: keep the trailing "#" in headings like "# C#" - #2
Merged
Merged
Conversation
parsedChecklistLine stripped heading markup with trimmingCharacters(in: CharacterSet(charactersIn: "# ")), which trims BOTH ends. Any heading ending in "#" silently lost it: "# C#" rendered as "C" "# F#" rendered as "F" "# C# vs F#" rendered as "C# vs F" DisplayLine lives in Shared/Sources, so this hit the editor and the widget on both platforms -- and "C#"/"F#" headings are ordinary content in a developer cheat sheet, which is what this app is for. Strip only the leading hashes instead, then trim whitespace. Adds two regression tests. Verified: 57 tests in 5 suites pass on macOS (was 55). The fixed parser was also compiled standalone against the four pre-existing heading/task/plain cases to confirm nothing outside the bug changed behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The bug
String.parsedChecklistLinestripped heading markup with:trimmingCharacters(in:)trims both ends, so any heading ending in#lost it:# C#CC## F#FF## C# vs F#C# vs FC# vs F## Shell #ShellShell #DisplayLinelives inShared/Sources, so this affected the editor and the widget, on both platforms. For an app whose purpose is developer cheat sheets,C#andF#headings are ordinary content — this is a plausible first-session bug for a real user.The fix
Strip only the leading hashes, then trim whitespace. Two regression tests added to
DisplayLineTests.swift.Verification
Found while auditing test coverage, not by a failing test — nothing exercised a heading with a trailing
#.🤖 Generated with Claude Code