mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-21 16:30:12 +01:00
Fix bug handling HTML embedded in a table.
This commit is contained in:
parent
5877f4b590
commit
e60e16baf0
3 changed files with 26 additions and 5 deletions
|
|
@ -80,8 +80,21 @@ function lintContent(content, config, frontMatter) { // eslint-disable-line
|
|||
var tokens = md.parse(content, {});
|
||||
var lines = content.split(shared.newLineRe);
|
||||
var tokenLists = {};
|
||||
var tbodyMap = null;
|
||||
// Annotate tokens with line/lineNumber
|
||||
tokens.forEach(function forToken(token) {
|
||||
// Handle missing maps for table body
|
||||
if (token.type === "tbody_open") {
|
||||
tbodyMap = token.map.slice();
|
||||
} else if ((token.type === "tr_close") && tbodyMap) {
|
||||
tbodyMap[0]++;
|
||||
} else if (token.type === "tbody_close") {
|
||||
tbodyMap = null;
|
||||
}
|
||||
if (tbodyMap && !token.map) {
|
||||
token.map = tbodyMap.slice();
|
||||
}
|
||||
// Update token metadata
|
||||
if (token.map) {
|
||||
token.line = lines[token.map[0]];
|
||||
token.lineNumber = token.map[0] + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue