一片一片 a9bd03ef57
fix(citations): keep copied markdown references valid (#7743)
* fix(citations): keep copied markdown references valid

formatCitationMarkdownReference pasted the source title and URL into
"[title](url)" verbatim. A title with a stray "[" or "]" ends the link text
early, and a URL with an unbalanced parenthesis ends the destination, so a
copied reference no longer rendered as a link. Escape brackets in the title and
wrap a parenthesized URL in the angle-bracket form.

* fix(citations): only angle-bracket a parenthesized URL

normalizeUrl already percent-encodes "<", ">" and whitespace, so including
them in the trigger could wrap such a URL in an angle-bracket destination that
CommonMark forbids, which is worse than the bare form. Parentheses are the only
reachable delimiter that breaks the bare destination.
2026-10-31 23:00:39 +08:00
..