mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Fix two bugs with bare list marker handling.
This commit is contained in:
parent
dab36c5afa
commit
6a8f31ddad
2 changed files with 13 additions and 3 deletions
|
@ -90,7 +90,7 @@ function flattenLists(tokens, filterBy) {
|
|||
var lists = [];
|
||||
var stack = [];
|
||||
var current = null;
|
||||
var lastWithMap = null;
|
||||
var lastWithMap = { "map": [ 0, 1 ] };
|
||||
tokens.forEach(function forToken(token) {
|
||||
if ((token.type === "bullet_list_open") ||
|
||||
(token.type === "ordered_list_open")) {
|
||||
|
@ -542,7 +542,7 @@ module.exports = [
|
|||
flattenLists(params.tokens, true).forEach(function forList(list) {
|
||||
var number = 1;
|
||||
list.items.forEach(function forItem(item) {
|
||||
var re = new RegExp("^\\s*" + String(number) + "\\. ");
|
||||
var re = new RegExp("^\\s*" + String(number) + "\\.");
|
||||
if (!re.test(item.line)) {
|
||||
errors.push(item.lineNumber);
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ module.exports = [
|
|||
(allSingle ? ulSingle : ulMulti);
|
||||
list.items.forEach(function forItem(item) {
|
||||
var match = /^\s*\S+(\s+)/.exec(item.line);
|
||||
if (match[1].length !== expectedSpaces) {
|
||||
if (!match || (match[1].length !== expectedSpaces)) {
|
||||
errors.push(item.lineNumber);
|
||||
}
|
||||
});
|
||||
|
|
10
test/bare-list-markers.md
Normal file
10
test/bare-list-markers.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
*
|
||||
|
||||
+
|
||||
|
||||
-
|
||||
|
||||
1.
|
||||
|
||||
{MD004:3}{MD004:5}
|
||||
{MD030:1}{MD030:3}{MD030:5}{MD030:7}
|
Loading…
Add table
Add a link
Reference in a new issue