mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Tokens inside tables that lack a map should get it from the surrounding table row (which is more scoped than the table body) (fixes #463).
This commit is contained in:
parent
1e82f76596
commit
11806dc5cb
6 changed files with 106 additions and 34 deletions
|
|
@ -1717,6 +1717,40 @@ test.cb("texmath test files with texmath plugin", (t) => {
|
|||
});
|
||||
});
|
||||
|
||||
test("token-map-spans", (t) => {
|
||||
t.plan(38);
|
||||
const options = {
|
||||
"customRules": [
|
||||
{
|
||||
"names": [ "token-map-spans" ],
|
||||
"description": "token-map-spans",
|
||||
"tags": [ "tms" ],
|
||||
"function": function tokenMapSpans(params) {
|
||||
const tokenLines = [];
|
||||
let lastLineNumber = -1;
|
||||
const inlines = params.tokens.filter((c) => c.type === "inline");
|
||||
for (const token of inlines) {
|
||||
t.truthy(token.map);
|
||||
for (let i = token.map[0]; i < token.map[1]; i++) {
|
||||
if (tokenLines.includes(i)) {
|
||||
t.true(
|
||||
lastLineNumber === token.lineNumber,
|
||||
`Line ${i + 1} is part of token maps from multiple lines.`
|
||||
);
|
||||
} else {
|
||||
tokenLines.push(i);
|
||||
}
|
||||
lastLineNumber = token.lineNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"files": [ "./test/token-map-spans.md" ]
|
||||
};
|
||||
markdownlint.sync(options);
|
||||
});
|
||||
|
||||
test("getVersion", (t) => {
|
||||
t.plan(1);
|
||||
const actual = markdownlint.getVersion();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue