From a84430902fa4116b100d279746dd1c9b0c2110c4 Mon Sep 17 00:00:00 2001 From: Yanhu007 Date: Tue, 14 Apr 2026 14:47:33 +0800 Subject: [PATCH] fix(linkify): strip trailing quotes from auto-linked URLs The linkify parser trims trailing punctuation (., ), ;) from auto-detected URLs but does not handle quote characters. When combined with the typographer extension, a URL like: "https://example.org/" produces a broken href with the closing quote encoded as %22, because linkify includes it in the URL before typographer can convert it to a smart quote. Strip trailing double and single quotes from auto-linked URLs, matching the existing behavior for other trailing punctuation. Fixes #335 --- extension/linkify.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extension/linkify.go b/extension/linkify.go index f76e31d..25d824b 100644 --- a/extension/linkify.go +++ b/extension/linkify.go @@ -234,6 +234,8 @@ func (s *linkifyParser) Parse(parent ast.Node, block text.Reader, pc parser.Cont m[1] -= m[1] - i } } + } else if lastChar == '"' || lastChar == '\'' { + m[1]-- } } if m == nil {