mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update clearHtmlCommentText helper to match CommonMark (instead of HTML) specification (refs #361).
This commit is contained in:
parent
6f39df1417
commit
c4e236b858
6 changed files with 148 additions and 48 deletions
|
|
@ -9,6 +9,12 @@ const helpers = require("../helpers");
|
|||
test("clearHtmlCommentTextValid", (t) => {
|
||||
t.plan(1);
|
||||
const validComments = [
|
||||
"<!-->",
|
||||
"<!--->",
|
||||
"<!---->",
|
||||
"<!-- comment -->",
|
||||
" <!-- comment -->",
|
||||
" <!-- comment -->",
|
||||
"<!-- text -->",
|
||||
"<!--text-->",
|
||||
"<!-- -->",
|
||||
|
|
@ -47,6 +53,12 @@ test("clearHtmlCommentTextValid", (t) => {
|
|||
"text"
|
||||
];
|
||||
const validResult = [
|
||||
"<!-->",
|
||||
"<!--->",
|
||||
"<!---->",
|
||||
"<!-- -->",
|
||||
" <!-- -->",
|
||||
" <!-- -->",
|
||||
"<!-- -->",
|
||||
"<!-- -->",
|
||||
"<!-- -->",
|
||||
|
|
@ -100,22 +112,12 @@ test("clearHtmlCommentTextInvalid", (t) => {
|
|||
"<!-->text-->",
|
||||
"<!--->text-->",
|
||||
"<!---->",
|
||||
// Restrictions from specification
|
||||
"<!-->-->",
|
||||
"<!-->t-->",
|
||||
"<!--->-->",
|
||||
"<!--->t-->",
|
||||
"<!--<!--t-->",
|
||||
"<!--t<!---->",
|
||||
"<!--t<!--t-->",
|
||||
// "<!---->t-->",
|
||||
// "<!--t-->-->",
|
||||
// "<!--t-->t-->",
|
||||
"<!----!>t-->",
|
||||
"<!--t--!>-->",
|
||||
"<!--t--!>t-->",
|
||||
"<!--<!--->",
|
||||
"<!--t<!--->"
|
||||
"<!---->t-->",
|
||||
" <!-- indented code block -->"
|
||||
];
|
||||
const actual = helpers.clearHtmlCommentText(invalidComments.join("\n"));
|
||||
const expected = invalidComments.join("\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue