diff options
| author | Karl Bartel <karl42@gmail.com> | 2019-09-29 17:36:35 +0200 |
|---|---|---|
| committer | Enno Boland <g@s01.de> | 2020-07-01 08:56:22 +0200 |
| commit | 1793559632596f3c8e587553f1d7c87036437fb7 (patch) | |
| tree | d3d874fab6528c1616bcd1900e119523bb12a4c6 /smu.c | |
| parent | b76e431cc2aaf15e55b0f349cdb5df0f87759cbe (diff) | |
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 (limited to 'smu.c')
| -rw-r--r-- | smu.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -506,6 +506,14 @@ dosurround(const char *begin, const char *end, int newblock) { 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 |