smu

Simple markup processor
git clone https://git.sinitax.com/codemadness/smu
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 028a8dadd1f61f5b773b773b022ad2ccb86e3ddc
parent 7fa950993c6d6deafe7787547951abdcec6e1a55
Author: Karl Bartel <karl42@gmail.com>
Date:   Wed,  2 Oct 2019 13:07:03 +0200

Lists only continue when using same marker

```
- foo
- bar
+ baz
```
is two lists (see https://spec.commonmark.org/0.29/#example-271)

Diffstat:
Msmu.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/smu.c b/smu.c @@ -327,6 +327,7 @@ dolist(const char *begin, const char *end, int newblock) { unsigned int i, j, indent, run, ul, isblock; const char *p, *q; char *buffer = NULL; + char marker; isblock = 0; if(newblock) @@ -336,9 +337,10 @@ dolist(const char *begin, const char *end, int newblock) { else return 0; q = p; - if(*p == '-' || *p == '*' || *p == '+') + if(*p == '-' || *p == '*' || *p == '+') { ul = 1; - else { + marker = *p; + } else { ul = 0; for(; p < end && *p >= '0' && *p <= '9'; p++); if(p >= end || *p != '.') @@ -368,7 +370,7 @@ dolist(const char *begin, const char *end, int newblock) { } q = p + 1; j = 0; - if(ul && (*q == '-' || *q == '*' || *q == '+')) + if(ul && *q == marker) j = 1; else if(!ul) { for(; q + j != end && q[j] >= '0' && q[j] <= '9' && j < indent; j++);