mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Reimplement helpers.isBlankLine to fix an instance of "Polynomial regular expression used on uncontrolled data".
This commit is contained in:
parent
b9474e84a3
commit
1c89dd5776
3 changed files with 76 additions and 27 deletions
|
@ -226,7 +226,7 @@ bar`
|
|||
});
|
||||
|
||||
test("isBlankLine", (t) => {
|
||||
t.plan(29);
|
||||
t.plan(33);
|
||||
const blankLines = [
|
||||
null,
|
||||
"",
|
||||
|
@ -248,7 +248,9 @@ test("isBlankLine", (t) => {
|
|||
"<!--",
|
||||
" <!-- text",
|
||||
"text --> ",
|
||||
"-->"
|
||||
"-->",
|
||||
"text --> <!--text--> <!--text--> <!-- text",
|
||||
"text --> --> <!--text--> <!--text--> <!-- <!-- text"
|
||||
];
|
||||
blankLines.forEach((line) => t.true(helpers.isBlankLine(line), line || ""));
|
||||
const nonBlankLines = [
|
||||
|
@ -259,7 +261,9 @@ test("isBlankLine", (t) => {
|
|||
"<!--text--> text",
|
||||
"text <!--text-->",
|
||||
"text <!--",
|
||||
"--> text"
|
||||
"--> text",
|
||||
"text --> <!--text--> text <!--text--> <!-- text",
|
||||
"text --> --> <!--text--> text <!--text--> <!-- <!-- text"
|
||||
];
|
||||
nonBlankLines.forEach((line) => t.true(!helpers.isBlankLine(line), line));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue