commit b76e431cc2aaf15e55b0f349cdb5df0f87759cbe
parent 3e00caedeb16cdc3bb0740e2592064bf1823f7ad
Author: Karl Bartel <karl42@gmail.com>
Date: Sun, 29 Sep 2019 17:27:56 +0200
Skip empty lines at end of code block
See https://spec.commonmark.org/0.29/#example-87
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/smu.c b/smu.c
@@ -219,6 +219,12 @@ dolineprefix(const char *begin, const char *end, int newblock) {
p += l;
}
}
+
+ /* Skip empty lines in block */
+ while(*(buffer + j - 1) == '\n') {
+ j--;
+ }
+
ADDC(buffer, j) = '\0';
if(lineprefix[i].process)
process(buffer, buffer + strlen(buffer), lineprefix[i].process >= 2);