diff --git a/inline.go b/inline.go index ca7c6b1..ab58685 100644 --- a/inline.go +++ b/inline.go @@ -481,15 +481,17 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { } var uLink []byte - if len(link) > 0 { - var uLinkBuf bytes.Buffer - unescapeText(&uLinkBuf, link) - uLink = uLinkBuf.Bytes() - } + if t == linkNormal || t == linkImg { + if len(link) > 0 { + var uLinkBuf bytes.Buffer + unescapeText(&uLinkBuf, link) + uLink = uLinkBuf.Bytes() + } - // links need something to click on and somewhere to go - if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) { - return 0 + // links need something to click on and somewhere to go + if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) { + return 0 + } } // call the relevant rendering function diff --git a/inline_test.go b/inline_test.go index 584a584..f621529 100644 --- a/inline_test.go +++ b/inline_test.go @@ -635,6 +635,9 @@ what happens here `, + + "empty footnote[^]\n\n[^]: fn text", + "
empty footnote1
\n