diff --git a/block.go b/block.go index 298aa4d..a992f03 100644 --- a/block.go +++ b/block.go @@ -1269,10 +1269,9 @@ func (p *parser) renderParagraph(out *bytes.Buffer, data []byte) { end-- } - work := func() { - p.inline(out, data[beg:end]) - } - p.r.Paragraph(out, work) + p.r.BeginParagraph(out) + p.inline(out, data[beg:end]) + p.r.EndParagraph(out) } func (p *parser) paragraph(out *bytes.Buffer, data []byte) int { diff --git a/html.go b/html.go index 12c60b5..2169353 100644 --- a/html.go +++ b/html.go @@ -418,11 +418,12 @@ func (options *Html) ListItem(out *bytes.Buffer, text []byte, flags ListType) { } } -func (options *Html) Paragraph(out *bytes.Buffer, text func()) { +func (r *Html) BeginParagraph(out *bytes.Buffer) { doubleSpace(out) - out.WriteString("

") - text() +} + +func (r *Html) EndParagraph(out *bytes.Buffer) { out.WriteString("

\n") } diff --git a/latex.go b/latex.go index 67783dc..c3f10a9 100644 --- a/latex.go +++ b/latex.go @@ -119,9 +119,11 @@ func (options *Latex) ListItem(out *bytes.Buffer, text []byte, flags ListType) { out.Write(text) } -func (options *Latex) Paragraph(out *bytes.Buffer, text func()) { +func (r *Latex) BeginParagraph(out *bytes.Buffer) { out.WriteString("\n") - text() +} + +func (r *Latex) EndParagraph(out *bytes.Buffer) { out.WriteString("\n") } diff --git a/markdown.go b/markdown.go index 289047c..a4c03ab 100644 --- a/markdown.go +++ b/markdown.go @@ -169,7 +169,8 @@ type Renderer interface { BeginList(out *bytes.Buffer, flags ListType) EndList(out *bytes.Buffer, flags ListType) ListItem(out *bytes.Buffer, text []byte, flags ListType) - Paragraph(out *bytes.Buffer, text func()) + BeginParagraph(out *bytes.Buffer) + EndParagraph(out *bytes.Buffer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) TableRow(out *bytes.Buffer, text []byte) TableHeaderCell(out *bytes.Buffer, text []byte, flags int)