diff --git a/lib/insert.js b/lib/insert.js index 72ae02f..cdfbb13 100644 --- a/lib/insert.js +++ b/lib/insert.js @@ -58,18 +58,18 @@ function insert(node, parent, tight) { } else if (last && last.type === LIST) { node.depth--; - insert(node, last); + insert(node, last, tight); } else if (parent.type === LIST) { item = listItem(); - insert(node, item); + insert(node, item, tight); children.push(item); } else { item = list(); node.depth--; - insert(node, item); + insert(node, item, tight); children.push(item); } diff --git a/test/fixtures/tight/input.md b/test/fixtures/tight/input.md index 9b87337..dc4e6ff 100644 --- a/test/fixtures/tight/input.md +++ b/test/fixtures/tight/input.md @@ -6,4 +6,8 @@ Text. ## Something elsefi +### Yet Another Thing + +### And another thing + # Something iffi diff --git a/test/fixtures/tight/output.json b/test/fixtures/tight/output.json index 5ce4d91..c333471 100644 --- a/test/fixtures/tight/output.json +++ b/test/fixtures/tight/output.json @@ -70,6 +70,56 @@ ] } ] + }, + { + "type": "list", + "ordered": false, + "children": [ + { + "type": "listItem", + "loose": false, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "link", + "title": null, + "url": "#yet-another-thing", + "children": [ + { + "type": "text", + "value": "Yet Another Thing" + } + ] + } + ] + } + ] + }, + { + "type": "listItem", + "loose": false, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "link", + "title": null, + "url": "#and-another-thing", + "children": [ + { + "type": "text", + "value": "And another thing" + } + ] + } + ] + } + ] + } + ] } ] }