summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-08-08 13:10:10 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-08-08 13:10:47 -0700
commita4f61e832fa9f99e04d05ab4b4768538ba076c84 (patch)
tree37c52839620de5198487327e2fdfa5823b9c38af /src
parent2c3612447e35c879ad99e637dd473ec58fde9fd0 (diff)
Treat line ending with EOF as ending with newline.
Closes #71. Added a test to api_test.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/blocks.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/blocks.c b/src/blocks.c
index f1e3a7a..4432f78 100755
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -598,6 +598,10 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
} else {
cmark_strbuf_put(parser->curline, buffer, bytes);
}
+ // ensure line ends with a newline:
+ if (!S_is_line_end_char(parser->curline->ptr[bytes - 1])) {
+ cmark_strbuf_putc(parser->curline, '\n');
+ }
parser->offset = 0;
parser->column = 0;
parser->blank = false;