mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
added slice bounds check
This commit is contained in:
parent
c23099e5ee
commit
1a73bae554
|
@ -613,6 +613,27 @@ what happens here
|
|||
</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>
|
||||
`,
|
||||
}
|
||||
|
||||
|
|
|
@ -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++
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user