Ignore single space around code span - smu - smu - simple markup (Markdown) pro… | |
git clone git://git.codemadness.org/smu | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 1793559632596f3c8e587553f1d7c87036437fb7 | |
parent b76e431cc2aaf15e55b0f349cdb5df0f87759cbe | |
Author: Karl Bartel <[email protected]> | |
Date: Sun, 29 Sep 2019 17:36:35 +0200 | |
Ignore single space around code span | |
According to https://spec.commonmark.org/0.29/#code-spans : | |
> If the resulting string both begins and ends with a space character, | |
but does not consist entirely of space characters, a single space | |
character is removed from the front and back. This allows you to include | |
code that begins or ends with backtick characters, which must be | |
separated by whitespace from the opening or closing backtick strings. | |
Diffstat: | |
M smu.c | 8 ++++++++ | |
1 file changed, 8 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/smu.c b/smu.c | |
@@ -506,6 +506,14 @@ dosurround(const char *begin, const char *end, int newbloc… | |
if(!stop || stop < start || stop >= end) | |
continue; | |
fputs(surround[i].before, stdout); | |
+ | |
+ /* Single space at start and end are ignored */ | |
+ if (*start == ' ' && *(stop - 1) == ' ') { | |
+ start++; | |
+ stop--; | |
+ l++; | |
+ } | |
+ | |
if(surround[i].process) | |
process(start, stop, 0); | |
else |