summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Bartel <karl42@gmail.com>2019-09-29 17:27:56 +0200
committerEnno Boland <g@s01.de>2020-07-01 08:56:22 +0200
commitb76e431cc2aaf15e55b0f349cdb5df0f87759cbe (patch)
tree2684fdd3579621ce84f8f9d28c6401537409aa94
parent3e00caedeb16cdc3bb0740e2592064bf1823f7ad (diff)
Skip empty lines at end of code block
See https://spec.commonmark.org/0.29/#example-87
-rw-r--r--smu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/smu.c b/smu.c
index 4684b96..da9b652 100644
--- 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);