mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Fix #335
This commit is contained in:
parent
a87c5778f9
commit
5b0f611119
2 changed files with 23 additions and 1 deletions
|
|
@ -277,7 +277,7 @@ func (s *linkifyParser) Parse(parent ast.Node, block text.Reader, pc parser.Cont
|
||||||
for ; i > 0; i-- {
|
for ; i > 0; i-- {
|
||||||
c := line[i]
|
c := line[i]
|
||||||
switch c {
|
switch c {
|
||||||
case '?', '!', '.', ',', ':', '*', '_', '~':
|
case '?', '!', '.', ',', ':', '*', '_', '~', '\'', '"':
|
||||||
default:
|
default:
|
||||||
goto endfor
|
goto endfor
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,28 @@ func TestLinkify(t *testing.T) {
|
||||||
testutil.DoTestCaseFile(markdown, "_test/linkify.txt", t, testutil.ParseCliCaseArg()...)
|
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>‘<a href="http://example.com/">http://example.com/</a>’ “<a href="http://example.com/">http://example.com/</a>”</p>`,
|
||||||
|
},
|
||||||
|
t,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func TestLinkifyWithAllowedProtocols(t *testing.T) {
|
func TestLinkifyWithAllowedProtocols(t *testing.T) {
|
||||||
markdown := goldmark.New(
|
markdown := goldmark.New(
|
||||||
goldmark.WithRendererOptions(
|
goldmark.WithRendererOptions(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue