Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions render.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (o *Op) writeBlock(vars *renderVars) {

// Avoid empty paragraphs and "\n" in the output for text blocks.
if o.Data == "" && block.tagName == "p" && vars.tempBuf.Len() == 0 {
o.Data = "<br>"
o.Data = "<br/>"
}

if block.tagName != "" {
Expand All @@ -227,7 +227,7 @@ func (o *Op) writeBlock(vars *renderVars) {

vars.finalBuf.Write(vars.tempBuf.Bytes()) // Copy the temporary buffer to the final output.

vars.finalBuf.WriteString(o.Data) // Copy the data of the current Op (usually just "<br>" or blank).
vars.finalBuf.WriteString(o.Data) // Copy the data of the current Op (usually just "<br/>" or blank).

if block.tagName != "" {
closeTag(&vars.finalBuf, block.tagName)
Expand Down
4 changes: 2 additions & 2 deletions render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ func TestSimple(t *testing.T) {
}{
"empty": {
ops: `[{"insert": "\n"}]`,
want: "<p><br></p>",
want: "<p><br/></p>",
},
"two paragraphs (single op)": {
ops: `[{"insert": "line1\nline2\n"}]`,
want: "<p>line1</p><p>line2</p>",
},
"blank line": {
ops: `[{"insert": "line1\n\nline3\n"}]`,
want: "<p>line1</p><p><br></p><p>line3</p>",
want: "<p>line1</p><p><br/></p><p>line3</p>",
},
"blockquote": {
ops: `[{"insert": "bkqt"}, {"attributes": {"blockquote": true}, "insert": "\n"}]`,
Expand Down