Fix list parsing & ensure line breaks inside lists are handled correctly

- Break list when kind of bullet changes
- Ensure we render multiline list items correctly
This commit is contained in:
Niklas Fasching 2018-12-03 19:27:57 +01:00
parent 043095e672
commit 213da0beff
3 changed files with 45 additions and 1 deletions

View file

@ -54,7 +54,7 @@ func (d *Document) parseList(i int, parentStop stopFn) (int, Node) {
start, lvl := i, d.tokens[i].lvl
list := List{Kind: listKind(d.tokens[i])}
for !parentStop(d, i) && d.tokens[i].lvl == lvl && isListToken(d.tokens[i]) {
for !parentStop(d, i) && d.tokens[i].lvl == lvl && isListToken(d.tokens[i]) && listKind(d.tokens[i]) == list.Kind {
consumed, node := d.parseListItem(i, parentStop)
i += consumed
list.Items = append(list.Items, node)