diff --git a/inline_test.go b/inline_test.go index 3a307b8..584a584 100644 --- a/inline_test.go +++ b/inline_test.go @@ -613,6 +613,27 @@ what happens here +`, + + `This is a footnote[^1]^[and this is an inline footnote] + +[^1]: the footnote text. + + may be multiple paragraphs. +`, + `

This is a footnote12

+
+ +
+ +
    +
  1. the footnote text.

    + +

    may be multiple paragraphs.

    +
  2. +
  3. and this is an inline footnote
  4. +
+
`, } diff --git a/markdown.go b/markdown.go index 6967bec..63b3f35 100644 --- a/markdown.go +++ b/markdown.go @@ -589,12 +589,12 @@ func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffse // extracted text that was shifted over one tab. It will need to be rendered at // the end of the document. func scanFootnote(p *parser, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) { - if i == 0 { + if i == 0 || len(data) == 0 { return } // skip leading whitespace on first line - for data[i] == ' ' { + for i < len(data) && data[i] == ' ' { i++ }