fix: strip trailing CJK/ASCII punctuation from bare URLs - #146
Merged
Conversation
Bare autolinks were swallowing trailing Chinese commas/periods (and English punctuation after host-only URLs) because excluded ending chars only covered ASCII bytes. Stop at multi-byte CJK punctuation and apply the same trailing ASCII rules to the host part. Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
|
|
tiensonqin
marked this pull request as ready for review
August 30, 2026 00:56
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
ocaml/setup-ocaml already caches the opam switch; turning on dune-cache speeds up incremental dune builds across CI runs. Co-authored-by: Tienson Qin <tiensonqin@gmail.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.
Summary
Bare autolinks were incorrectly including trailing punctuation:
,/。(and related CJK punct) after a URL were absorbed into the link (also reported in Chinese period is parsed into URL logseq#7634),/.after host-only URLs likehttp://example.com.were included (path URLs already stripped these)Root cause: ending punctuation was only handled as ASCII
chars inexcluded_ending_chars. Multi-byte UTF-8 CJK punctuation could never match, and the host (before_path) parser did not apply trailing-ASCII rules at all.Fix
,。;!?、:) as hard URL terminators (never part of the URL)string_contains_balanced_bracketswithexcluded_ending_stringsfor multi-byte stoppersCI
dune-cache: trueonocaml/setup-ocamlin Build and Format workflows (opam switch cache was already automatic)Test plan
,.and Chinese,。dune runtestpasses