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
\n\n
\n\n
    \n
  1. fn text\n
  2. \n
\n
\n", } doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, 0) diff --git a/markdown.go b/markdown.go index b0bf55e..8688683 100644 --- a/markdown.go +++ b/markdown.go @@ -508,7 +508,9 @@ func isReference(p *parser, data []byte, tabSize int) int { // id matches are case-insensitive id := string(bytes.ToLower(data[idOffset:idEnd])) + p.refs[id] = ref + return lineEnd }