Skip to content

Commit

Permalink
Correctly merge list blanks with non-list blanks
Browse files Browse the repository at this point in the history
Fixes #133
  • Loading branch information
notriddle authored and jgm committed Dec 2, 2023
1 parent 1ecf001 commit daa72ec
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion commonmark/src/Commonmark/Blocks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import qualified Data.Text as T
import qualified Data.Text.Read as TR
import Data.Tree
import Text.Parsec
import Data.List (sort)

mkBlockParser
:: (Monad m, IsBlock il bl)
Expand Down Expand Up @@ -865,7 +866,7 @@ listItemSpec parseListMarker = BlockSpec
let lidata = fromDyn (blockData cdata)
(ListItemData (BulletList '*')
0 False False)
let allblanks = concat $ blockBlanks cdata :
let allblanks = reverse . sort . concat $ blockBlanks cdata :
map (blockBlanks . rootLabel)
(filter ((== "List") . blockType .
blockSpec . rootLabel) children)
Expand Down
37 changes: 37 additions & 0 deletions commonmark/test/regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,40 @@ Issue #130
<p><a href="https://example.com" title="\
">my-link</a></p>
````````````````````````````````


Issue #133
```````````````````````````````` example
* * xx
* yy
zz
.
<ul>
<li><ul>
<li><p>xx</p>
<ul>
<li>yy</li>
</ul></li>
</ul>
<p>zz</p></li>
</ul>
````````````````````````````````

```````````````````````````````` example
* * xx
* yy
zz
.
<ul>
<li><ul>
<li>xx
<ul>
<li>yy</li>
</ul></li>
</ul>
<p>zz</p></li>
</ul>
````````````````````````````````
Expand Down

0 comments on commit daa72ec

Please sign in to comment.