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:
parent
043095e672
commit
213da0beff
3 changed files with 45 additions and 1 deletions
|
@ -54,7 +54,7 @@ func (d *Document) parseList(i int, parentStop stopFn) (int, Node) {
|
||||||
start, lvl := i, d.tokens[i].lvl
|
start, lvl := i, d.tokens[i].lvl
|
||||||
|
|
||||||
list := List{Kind: listKind(d.tokens[i])}
|
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)
|
consumed, node := d.parseListItem(i, parentStop)
|
||||||
i += consumed
|
i += consumed
|
||||||
list.Items = append(list.Items, node)
|
list.Items = append(list.Items, node)
|
||||||
|
|
32
org/testdata/example.html
vendored
32
org/testdata/example.html
vendored
|
@ -253,6 +253,38 @@ either <code>this</code> or <code>that</code> foo.
|
||||||
either <code>this</code>
|
either <code>this</code>
|
||||||
or <code>that</code> foo.
|
or <code>that</code> foo.
|
||||||
</p>
|
</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'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>
|
<h3><a href="https://github.com/chaseadamsio/goorgeous/issues/68">#68</a>: Quote block with inline markup</h3>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>
|
<p>
|
||||||
|
|
12
org/testdata/example.org
vendored
12
org/testdata/example.org
vendored
|
@ -120,6 +120,18 @@ crazy ain't it?
|
||||||
either ~this~ or ~that~ foo.
|
either ~this~ or ~that~ foo.
|
||||||
either ~this~
|
either ~this~
|
||||||
or ~that~ foo.
|
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
|
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/68][#68]]: Quote block with inline markup
|
||||||
#+BEGIN_QUOTE
|
#+BEGIN_QUOTE
|
||||||
[[https://www.example.com][/this/ *is* _markup_!]]
|
[[https://www.example.com][/this/ *is* _markup_!]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue