From 037e66e414fd8e2253a7af12ba9db8a2ec8836a2 Mon Sep 17 00:00:00 2001 From: Mateus Craveiro Date: Wed, 19 Dec 2018 19:07:33 -0200 Subject: [PATCH] Fix empty list items --- lib/marked.js | 4 ++-- test/specs/commonmark/commonmark-spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/marked.js b/lib/marked.js index 15ad63bfe7..4595336daf 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -45,7 +45,7 @@ block.def = edit(block.def) .getRegex(); block.bullet = /(?:[*+-]|\d{1,9}\.)/; -block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; +block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/; block.item = edit(block.item, 'gm') .replace(/bull/g, block.bullet) .getRegex(); @@ -342,7 +342,7 @@ Lexer.prototype.token = function(src, top) { // Remove the list item's bullet // so it is seen as the next token. space = item.length; - item = item.replace(/^ *([*+-]|\d+\.) +/, ''); + item = item.replace(/^ *([*+-]|\d+\.) */, ''); // Outdent whatever the // list item contains. Hacky. diff --git a/test/specs/commonmark/commonmark-spec.js b/test/specs/commonmark/commonmark-spec.js index 5b62131134..2eb261a664 100644 --- a/test/specs/commonmark/commonmark-spec.js +++ b/test/specs/commonmark/commonmark-spec.js @@ -248,7 +248,7 @@ describe('CommonMark 0.28 List items', function() { var section = 'List items'; // var shouldPassButFails = []; - var shouldPassButFails = [237, 236, 227, 218, 243, 259, 241, 239, 247, 246, 225, 220, 258, 260, 244]; + var shouldPassButFails = [237, 236, 227, 218, 243, 259, 241, 239, 247, 225, 220, 258, 260]; var willNotBeAttemptedByCoreTeam = []; @@ -263,7 +263,7 @@ describe('CommonMark 0.28 Lists', function() { var section = 'Lists'; // var shouldPassButFails = []; - var shouldPassButFails = [282, 270, 280, 278, 273, 274, 264, 265, 276, 279, 267, 269]; + var shouldPassButFails = [282, 270, 280, 278, 273, 274, 264, 265, 279, 267, 269]; var willNotBeAttemptedByCoreTeam = [];