Skip to content

Commit

Permalink
Fix yuin#335
Browse files Browse the repository at this point in the history
  • Loading branch information
tenevdev committed Nov 15, 2022
1 parent a87c577 commit 5b0f611
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion extension/linkify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
22 changes: 22 additions & 0 deletions extension/linkify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 5b0f611

Please sign in to comment.