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)

View file

@ -253,6 +253,38 @@ either <code>this</code> or <code>that</code> foo.
either <code>this</code>
or <code>that</code> foo.
</p>
<h3><a href="https://github.com/chaseadamsio/goorgeous/issues/50">#50</a>: Linebreaks in lists are preserved</h3>
<ul>
<li>
<p>
this list item
has
multiple
linbreaks - but it&#39;s still just one paragraph (i.e. no line breaks are rendered)
</p>
</li>
<li>
<p>
foobar
</p>
</li>
</ul>
<ol>
<li>
<p>
same
goes
for
ordered
lists
</p>
</li>
<li>
<p>
foo
</p>
</li>
</ol>
<h3><a href="https://github.com/chaseadamsio/goorgeous/issues/68">#68</a>: Quote block with inline markup</h3>
<blockquote>
<p>

View file

@ -120,6 +120,18 @@ crazy ain't it?
either ~this~ or ~that~ foo.
either ~this~
or ~that~ foo.
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/50][#50]]: Linebreaks in lists are preserved
- this list item
has
multiple
linbreaks - but it's still just one paragraph (i.e. no line breaks are rendered)
- foobar
1. same
goes
for
ordered
lists
2. foo
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/68][#68]]: Quote block with inline markup
#+BEGIN_QUOTE
[[https://www.example.com][/this/ *is* _markup_!]]