mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Stop running the markdown-it parser unless a custom rule that requires it is present (~7% runtime reduction).
This commit is contained in:
parent
697780b3b6
commit
ea8d596a9b
5 changed files with 102 additions and 36 deletions
|
|
@ -1109,6 +1109,8 @@ test("markdownItPluginsSingle", (t) => new Promise((resolve) => {
|
|||
"strings": {
|
||||
"string": "# Heading\n\nText\n"
|
||||
},
|
||||
// Use a markdown-it custom rule so the markdown-it plugin will be run
|
||||
"customRules": customRules.anyBlockquote,
|
||||
"markdownItPlugins": [
|
||||
[ pluginInline, "check_text_plugin", "text", () => t.true(true) ]
|
||||
]
|
||||
|
|
@ -1126,6 +1128,8 @@ test("markdownItPluginsMultiple", (t) => new Promise((resolve) => {
|
|||
"strings": {
|
||||
"string": "# Heading\n\nText H~2~0 text 29^th^ text\n"
|
||||
},
|
||||
// Use a markdown-it custom rule so the markdown-it plugin will be run
|
||||
"customRules": customRules.anyBlockquote,
|
||||
"markdownItPlugins": [
|
||||
[ pluginSub ],
|
||||
[ pluginSup ],
|
||||
|
|
@ -1140,6 +1144,23 @@ test("markdownItPluginsMultiple", (t) => new Promise((resolve) => {
|
|||
});
|
||||
}));
|
||||
|
||||
test("markdownItPluginsNoMarkdownIt", (t) => new Promise((resolve) => {
|
||||
t.plan(2);
|
||||
markdownlint({
|
||||
"strings": {
|
||||
"string": "# Heading\n\nText\n"
|
||||
},
|
||||
"markdownItPlugins": [
|
||||
[ pluginInline, "check_text_plugin", "text", () => t.fail() ]
|
||||
]
|
||||
}, function callback(err, actual) {
|
||||
t.falsy(err);
|
||||
const expected = { "string": [] };
|
||||
t.deepEqual(actual, expected, "Unexpected issues.");
|
||||
resolve();
|
||||
});
|
||||
}));
|
||||
|
||||
test("Pandoc footnote", (t) => new Promise((resolve) => {
|
||||
t.plan(2);
|
||||
markdownlint({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue