From c01ca4fd71294898ae38fef1792c95289c58ce07 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sat, 1 Oct 2016 01:42:06 +0900 Subject: [PATCH 1/3] Task list should hide heading bullet According to github-markdown-css, 'task-list-item' class will hide the bullets on the head of list items. --- lib/handlers/list-item.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/handlers/list-item.js b/lib/handlers/list-item.js index e8df28e..c3dc83c 100644 --- a/lib/handlers/list-item.js +++ b/lib/handlers/list-item.js @@ -32,6 +32,7 @@ function listItem(h, node, parent) { var single = (!parent || !parent.loose) && head.children && children.length === 1; var result = all(h, single ? head : node); var container; + var props = {}; if (typeof node.checked === 'boolean') { if (!single && head.type !== 'paragraph') { @@ -49,11 +50,14 @@ function listItem(h, node, parent) { checked: node.checked, disabled: true })); + + /* according to github-markdown-css, this class hides bullet. */ + props.className = 'task-list-item'; } if (!single && result.length) { result = wrap(result, true); } - return h(node, 'li', result); + return h(node, 'li', props, result); } From 73773ff59158cff3cb55cdc631c4ad49e70cffe1 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sat, 1 Oct 2016 01:54:29 +0900 Subject: [PATCH 2/3] Fix tests related to task list --- test/list-item.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/list-item.js b/test/list-item.js index 1dea1bb..094a63e 100644 --- a/test/list-item.js +++ b/test/list-item.js @@ -50,7 +50,7 @@ test('ListItem', function (t) { to(u('listItem', {checked: true}, [ u('paragraph', [u('text', 'québec')]) ])), - u('element', {tagName: 'li', properties: {}}, [ + u('element', {tagName: 'li', properties: {className: 'task-list-item'}}, [ u('element', { tagName: 'input', properties: { @@ -70,7 +70,7 @@ test('ListItem', function (t) { u('paragraph', [u('text', 'romeo')]), u('paragraph', [u('text', 'sierra')]) ])), - u('element', {tagName: 'li', properties: {}}, [ + u('element', {tagName: 'li', properties: {className: 'task-list-item'}}, [ u('text', '\n'), u('element', {tagName: 'p', properties: {}}, [ u('element', { @@ -97,7 +97,7 @@ test('ListItem', function (t) { to(u('listItem', {checked: true}, [ u('html', '') ])), - u('element', {tagName: 'li', properties: {}}, [ + u('element', {tagName: 'li', properties: {className: 'task-list-item'}}, [ u('text', '\n'), u('element', {tagName: 'p', properties: {}}, [ u('element', { From b7f7a729374d42b39e6b9021377a51a476a4612e Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 2 Oct 2016 02:25:50 +0900 Subject: [PATCH 3/3] 'className' should have array value --- lib/handlers/list-item.js | 2 +- test/list-item.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/handlers/list-item.js b/lib/handlers/list-item.js index c3dc83c..fd3f0a6 100644 --- a/lib/handlers/list-item.js +++ b/lib/handlers/list-item.js @@ -52,7 +52,7 @@ function listItem(h, node, parent) { })); /* according to github-markdown-css, this class hides bullet. */ - props.className = 'task-list-item'; + props.className = ['task-list-item']; } if (!single && result.length) { diff --git a/test/list-item.js b/test/list-item.js index 094a63e..4fc200a 100644 --- a/test/list-item.js +++ b/test/list-item.js @@ -50,7 +50,7 @@ test('ListItem', function (t) { to(u('listItem', {checked: true}, [ u('paragraph', [u('text', 'québec')]) ])), - u('element', {tagName: 'li', properties: {className: 'task-list-item'}}, [ + u('element', {tagName: 'li', properties: {className: ['task-list-item']}}, [ u('element', { tagName: 'input', properties: { @@ -70,7 +70,7 @@ test('ListItem', function (t) { u('paragraph', [u('text', 'romeo')]), u('paragraph', [u('text', 'sierra')]) ])), - u('element', {tagName: 'li', properties: {className: 'task-list-item'}}, [ + u('element', {tagName: 'li', properties: {className: ['task-list-item']}}, [ u('text', '\n'), u('element', {tagName: 'p', properties: {}}, [ u('element', { @@ -97,7 +97,7 @@ test('ListItem', function (t) { to(u('listItem', {checked: true}, [ u('html', '') ])), - u('element', {tagName: 'li', properties: {className: 'task-list-item'}}, [ + u('element', {tagName: 'li', properties: {className: ['task-list-item']}}, [ u('text', '\n'), u('element', {tagName: 'p', properties: {}}, [ u('element', {