all repos — grayfriday @ 1a73bae554f900bcd04a18b9d68eb9d6692c6a3d

blackfriday fork with a few changes

added slice bounds check
moshee moshee@displaynone.us
Mon, 08 Jul 2013 06:54:25 +0000
commit

1a73bae554f900bcd04a18b9d68eb9d6692c6a3d

parent

c23099e5ee07416d22e09d96f1872810d549579c

2 files changed, 23 insertions(+), 2 deletions(-)

jump to
M inline_test.goinline_test.go

@@ -614,6 +614,27 @@ </li>

</ol> </div> `, + + `This is a footnote[^1]^[and this is an inline footnote] + +[^1]: the footnote text. + + may be multiple paragraphs. +`, + `<p>This is a footnote<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup><sup class="footnote-ref" id="fnref:and-this-is-an-i"><a rel="footnote" href="#fn:and-this-is-an-i">2</a></sup></p> +<div class="footnotes"> + +<hr /> + +<ol> +<li id="fn:1"><p>the footnote text.</p> + +<p>may be multiple paragraphs.</p> +</li> +<li id="fn:and-this-is-an-i">and this is an inline footnote</li> +</ol> +</div> +`, } doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, 0)
M markdown.gomarkdown.go

@@ -589,12 +589,12 @@ // blockEnd is the end of the section in the input buffer, and contents is the

// 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++ }