Cache results of inlineCodeSpanRanges for use by MD011/MD044.

This commit is contained in:
David Anson 2021-06-17 22:01:27 -07:00
parent 706f48bd25
commit 7d40926367
6 changed files with 56 additions and 39 deletions

View file

@ -306,14 +306,14 @@ module.exports.forEachLine = function forEachLine(lineMetadata, handler) {
};
// Returns (nested) lists as a flat array (in order)
module.exports.flattenLists = function flattenLists(params) {
module.exports.flattenLists = function flattenLists(tokens) {
const flattenedLists = [];
const stack = [];
let current = null;
let nesting = 0;
const nestingStack = [];
let lastWithMap = { "map": [ 0, 1 ] };
params.tokens.forEach((token) => {
tokens.forEach((token) => {
if (isMathBlock(token) && token.map[1]) {
// markdown-it-texmath plugin does not account for math_block_end
token.map[1]++;