fix: cut bare URLs at non-URL characters and mask markdown links - #184
Merged
Merged
Conversation
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.
Problem
Follow-up to #172: the ASCII trailing-trim from #175 does not cover Unicode punctuation (curly quotes/apostrophes, CJK brackets), and cannot handle punctuation followed by more prose characters —
*[t](url)*’swas checked as…a)*’sand a barehttps://x.com/a’skept the apostrophe and suffix, because trailing-trim stops at the first non-trimmable character (s) (issue comment).Change
Two principled layers replace character-set whack-a-mole in
extractBareUrls:[text](dest)syntax is blanked before bare extraction (like code spans). URLs in link syntax are collected from link metadata, so anything glued to the syntax (emphasis, curly quotes, possessives, CJK brackets) never reaches the extractor at all.’,”,」,。cut there, while IDN paths like…/wiki/日本語survive intact.The ASCII trailing trim (sentence punctuation, emphasis markers, balanced-paren guard) is retained for trailing grammar-valid junk like
).,;*_~. Nested-bracket link labels fall through to bare extraction cleanly and dedupe against the metadata link.Validation
npm run lint && npm run lint:obsidian-warnings && npm run build && npm test— 976 tests pass.Follow-up to #172