mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Reimplement MD037/no-space-in-emphasis to better handle multiple fixes on a line and more scenarios (fixes #251).
This commit is contained in:
parent
de86a26e4e
commit
29f16bf402
4 changed files with 121 additions and 40 deletions
|
@ -234,17 +234,22 @@ module.exports.getLineMetadata = function getLineMetadata(params) {
|
|||
}
|
||||
});
|
||||
filterTokens(params, "list_item_open", function forToken(token) {
|
||||
let count = 1;
|
||||
for (let i = token.map[0]; i < token.map[1]; i++) {
|
||||
lineMetadata[i][5] = true;
|
||||
lineMetadata[i][5] = count;
|
||||
count++;
|
||||
}
|
||||
});
|
||||
filterTokens(params, "hr", function forToken(token) {
|
||||
lineMetadata[token.map[0]][6] = true;
|
||||
});
|
||||
return lineMetadata;
|
||||
};
|
||||
|
||||
// Calls the provided function for each line (with context)
|
||||
module.exports.forEachLine = function forEachLine(lineMetadata, handler) {
|
||||
lineMetadata.forEach(function forMetadata(metadata) {
|
||||
// Parameters: line, lineIndex, inCode, onFence, inTable
|
||||
// Parameters: line, lineIndex, inCode, onFence, inTable, inBreak
|
||||
handler(...metadata);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue