1
0
mirror of https://github.com/danog/blackfriday.git synced 2024-12-02 09:27:49 +01:00

block.go: set fenceLength (#505)

This commit is contained in:
Robert Lowry 2019-01-20 12:09:27 -06:00 committed by Vytautas Šaltenis
parent 8bfdaf1a43
commit 0a297615e6

View File

@ -673,6 +673,7 @@ func (p *Markdown) fencedCodeBlock(data []byte, doRender bool) int {
if beg == 0 || beg >= len(data) { if beg == 0 || beg >= len(data) {
return 0 return 0
} }
fenceLength := beg - 1
var work bytes.Buffer var work bytes.Buffer
work.Write([]byte(info)) work.Write([]byte(info))
@ -706,6 +707,7 @@ func (p *Markdown) fencedCodeBlock(data []byte, doRender bool) int {
if doRender { if doRender {
block := p.addBlock(CodeBlock, work.Bytes()) // TODO: get rid of temp buffer block := p.addBlock(CodeBlock, work.Bytes()) // TODO: get rid of temp buffer
block.IsFenced = true block.IsFenced = true
block.FenceLength = fenceLength
finalizeCodeBlock(block) finalizeCodeBlock(block)
} }