Skip empty lines at end of code block - smu - smu - simple markup (Markdown) processor (fork, fixes + features) (HTM) git clone git://git.codemadness.org/smu (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit b76e431cc2aaf15e55b0f349cdb5df0f87759cbe (DIR) parent 3e00caedeb16cdc3bb0740e2592064bf1823f7ad (HTM) 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: M smu.c | 6 ++++++ 1 file changed, 6 insertions(+), 0 deletions(-) --- (DIR) 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);