This commit is contained in:
Tencho Tenev 2025-03-03 06:52:40 +00:00 committed by GitHub
commit e2c29bff52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View file

@ -279,7 +279,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
}

View file

@ -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: `<p>&lsquo;<a href="http://example.com/">http://example.com/</a>&rsquo; &ldquo;<a href="http://example.com/">http://example.com/</a>&rdquo;</p>`,
},
t,
)
}
func TestLinkifyWithAllowedProtocols(t *testing.T) {
markdown := goldmark.New(
goldmark.WithRendererOptions(