cmark

My personal build of CMark ✏️

Commit
48f0df56d24de06343bd6a52167f3f210c6c101d
Parent
cd231ce81f6dd7a84cfb843e9535ee260f1c30f9
Author
John MacFarlane <jgm@berkeley.edu>
Date

Add a newline to a line that doesn't end with one.

Closes #115.

Diffstat

1 file changed, 4 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 4 4 0
diff --git a/src/blocks.c b/src/blocks.c
@@ -460,6 +460,10 @@ static void incorporate_line(strbuf *line, int line_number, node_block** curptr)
 	int indent;
 	chunk input;
 
+	// Add a newline to the end if not present:
+	if (line->ptr[line->size - 1] != '\n') {
+	    strbuf_putc(line, '\n');
+	}
 	input.data = line->ptr;
 	input.len = line->size;