This commit is contained in:
Tencho Tenev 2022-11-15 17:59:26 +00:00
parent a87c5778f9
commit 5b0f611119
2 changed files with 23 additions and 1 deletions

View file

@ -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
}

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(