Stop running the markdown-it parser unless a custom rule that requires it is present (~7% runtime reduction).

This commit is contained in:
David Anson 2024-08-21 21:19:40 -07:00
parent 697780b3b6
commit ea8d596a9b
5 changed files with 102 additions and 36 deletions

View file

@ -563,7 +563,7 @@ is allowed to continue and report any violations that were found.
Type: `Array` of `Array` of `Function` and plugin parameters
Specifies additional [markdown-it plugins][markdown-it-plugin] to use when
Specifies additional [`markdown-it` plugins][markdown-it-plugin] to use when
parsing input. Plugins can be used to support additional syntax and features for
advanced scenarios.
@ -575,6 +575,13 @@ Each item in the top-level `Array` should be of the form:
[ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ]
```
> Note that `markdown-it` plugins are only called when the `markdown-it` parser
> is invoked. None of the built-in rules use the `markdown-it` parser, so
> `markdown-it` plugins will only be invoked when one or more
> [custom rules][custom-rules] that use the `markdown-it` parser are present.
[custom-rules]: #custom-rules
##### options.noInlineConfig
Type: `Boolean`