diff --git a/inline.go b/inline.go index db02091..455f8fe 100644 --- a/inline.go +++ b/inline.go @@ -180,8 +180,8 @@ const ( // '[': parse a link or an image or a footnote func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { - // no links allowed inside other links - if p.insideLink { + // no links allowed inside regular links, footnote, and deferred footnotes + if p.insideLink && (data[offset-1] == '[' || data[offset+1] == '^') { return 0 } diff --git a/inline_test.go b/inline_test.go index 60f764c..f7bc336 100644 --- a/inline_test.go +++ b/inline_test.go @@ -390,6 +390,9 @@ func TestInlineLink(t *testing.T) { "[link]( with whitespace )\n", "
\n", + "[](with image)\n", + "\n", + "[link](url \"one quote)\n", "\n",