Skip to content

Commit e5e5b09

Browse files
authored
Merge pull request #1395 from mccraveiro/empty-list
Fix empty list items
2 parents 27145cc + a0c8eea commit e5e5b09

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/marked.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ block.def = edit(block.def)
4545
.getRegex();
4646

4747
block.bullet = /(?:[*+-]|\d{1,9}\.)/;
48-
block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
48+
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
4949
block.item = edit(block.item, 'gm')
5050
.replace(/bull/g, block.bullet)
5151
.getRegex();
@@ -342,7 +342,7 @@ Lexer.prototype.token = function(src, top) {
342342
// Remove the list item's bullet
343343
// so it is seen as the next token.
344344
space = item.length;
345-
item = item.replace(/^ *([*+-]|\d+\.) +/, '');
345+
item = item.replace(/^ *([*+-]|\d+\.) */, '');
346346

347347
// Outdent whatever the
348348
// list item contains. Hacky.

test/specs/commonmark/commonmark-spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe('CommonMark 0.28 List items', function() {
248248
var section = 'List items';
249249

250250
// var shouldPassButFails = [];
251-
var shouldPassButFails = [237, 236, 227, 218, 243, 259, 241, 239, 247, 246, 225, 220, 258, 260, 244];
251+
var shouldPassButFails = [237, 236, 227, 218, 243, 259, 241, 239, 247, 225, 220, 258, 260];
252252

253253
var willNotBeAttemptedByCoreTeam = [];
254254

@@ -263,7 +263,7 @@ describe('CommonMark 0.28 Lists', function() {
263263
var section = 'Lists';
264264

265265
// var shouldPassButFails = [];
266-
var shouldPassButFails = [282, 270, 280, 278, 273, 274, 264, 265, 276, 279, 267, 269];
266+
var shouldPassButFails = [282, 270, 280, 278, 273, 274, 264, 265, 279, 267, 269];
267267

268268
var willNotBeAttemptedByCoreTeam = [];
269269

0 commit comments

Comments
 (0)