From 462d1792a2eb94639f45fe28eb6ade1d6e46005b Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Tue, 20 Dec 2016 14:55:28 -0500 Subject: [PATCH 1/3] add a failing test case --- test/fixtures/tight/input.md | 4 +++ test/fixtures/tight/output.json | 52 ++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) 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..18f50d8 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" + } + ] + } + ] + } + ] + } + ] } ] } @@ -101,4 +151,4 @@ } ] } -} +} \ No newline at end of file From 638c649bb1bebedc8d212d8f4bae5b82d28ececc Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Tue, 20 Dec 2016 14:54:50 -0500 Subject: [PATCH 2/3] always pass tight through to insert --- lib/insert.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); } From feac2b4391f48668a991c2ecb2d57e6983c55566 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Tue, 20 Dec 2016 15:00:42 -0500 Subject: [PATCH 3/3] add final newline on output.json --- test/fixtures/tight/output.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/tight/output.json b/test/fixtures/tight/output.json index 18f50d8..c333471 100644 --- a/test/fixtures/tight/output.json +++ b/test/fixtures/tight/output.json @@ -151,4 +151,4 @@ } ] } -} \ No newline at end of file +}