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.
This commit is contained in:
parent
b76e431cc2
commit
1793559632
1 changed files with 8 additions and 0 deletions
8
smu.c
8
smu.c
|
@ -506,6 +506,14 @@ dosurround(const char *begin, const char *end, int newblock) {
|
||||||
if(!stop || stop < start || stop >= end)
|
if(!stop || stop < start || stop >= end)
|
||||||
continue;
|
continue;
|
||||||
fputs(surround[i].before, stdout);
|
fputs(surround[i].before, stdout);
|
||||||
|
|
||||||
|
/* Single space at start and end are ignored */
|
||||||
|
if (*start == ' ' && *(stop - 1) == ' ') {
|
||||||
|
start++;
|
||||||
|
stop--;
|
||||||
|
l++;
|
||||||
|
}
|
||||||
|
|
||||||
if(surround[i].process)
|
if(surround[i].process)
|
||||||
process(start, stop, 0);
|
process(start, stop, 0);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue