From 5b0f611119dcda946322e798dbd0879d7f32a53a Mon Sep 17 00:00:00 2001 From: Tencho Tenev Date: Tue, 15 Nov 2022 17:59:26 +0000 Subject: [PATCH] Fix #335 --- extension/linkify.go | 2 +- extension/linkify_test.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/extension/linkify.go b/extension/linkify.go index 2f046eb..7ede216 100644 --- a/extension/linkify.go +++ b/extension/linkify.go @@ -277,7 +277,7 @@ func (s *linkifyParser) Parse(parent ast.Node, block text.Reader, pc parser.Cont for ; i > 0; i-- { c := line[i] switch c { - case '?', '!', '.', ',', ':', '*', '_', '~': + case '?', '!', '.', ',', ':', '*', '_', '~', '\'', '"': default: goto endfor } diff --git a/extension/linkify_test.go b/extension/linkify_test.go index d096aca..5f32c65 100644 --- a/extension/linkify_test.go +++ b/extension/linkify_test.go @@ -21,6 +21,28 @@ func TestLinkify(t *testing.T) { testutil.DoTestCaseFile(markdown, "_test/linkify.txt", t, testutil.ParseCliCaseArg()...) } +func TestLinkifyWithTypographer(t *testing.T) { + markdown := goldmark.New( + goldmark.WithRendererOptions( + html.WithUnsafe(), + ), + goldmark.WithExtensions( + Linkify, + Typographer, + ), + ) + + testutil.DoTestCase( + markdown, + testutil.MarkdownTestCase{ + No: 1, + Markdown: `'http://example.com/' "http://example.com/"`, + Expected: `

http://example.com/’ “http://example.com/

`, + }, + t, + ) +} + func TestLinkifyWithAllowedProtocols(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions(