mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Fix range calculation in MD033/no-inline-html during re-parse of tabbed content.
This commit is contained in:
parent
48a92d41a4
commit
c53df8b720
7 changed files with 65 additions and 6 deletions
|
@ -4953,11 +4953,13 @@ module.exports = {
|
|||
var options = {
|
||||
"extensions": [{
|
||||
"disable": {
|
||||
"null": ["htmlFlow"]
|
||||
"null": ["codeIndented", "htmlFlow"]
|
||||
}
|
||||
}]
|
||||
};
|
||||
var flowTokens = parse(token.text, options);
|
||||
// Use lines instead of token.text for accurate columns
|
||||
var lines = params.lines.slice(token.startLine - 1, token.endLine).join("\n");
|
||||
var flowTokens = parse(lines, options);
|
||||
pending.push([token.startLine - 1, flowTokens]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,12 +42,15 @@ module.exports = {
|
|||
"extensions": [
|
||||
{
|
||||
"disable": {
|
||||
"null": [ "htmlFlow" ]
|
||||
"null": [ "codeIndented", "htmlFlow" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
const flowTokens = parse(token.text, options);
|
||||
// Use lines instead of token.text for accurate columns
|
||||
const lines =
|
||||
params.lines.slice(token.startLine - 1, token.endLine).join("\n");
|
||||
const flowTokens = parse(lines, options);
|
||||
pending.push(
|
||||
[ token.startLine - 1, flowTokens ]
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD010": false,
|
||||
"MD033": {
|
||||
"allowed_elements": [
|
||||
"strong"
|
||||
|
|
|
@ -105,3 +105,14 @@ And neither is <foo_bar>.
|
|||
Nor <123abc>.
|
||||
|
||||
Text
|
||||
|
||||
<details>
|
||||
|
||||
{MD033:109}
|
||||
|
||||
<details>
|
||||
|
||||
- Item
|
||||
<details>
|
||||
|
||||
{MD033:116}
|
||||
|
|
|
@ -139,8 +139,7 @@ test("https://github.com/dotnet/docs", (t) => {
|
|||
const rootDir = "./test-repos/dotnet-docs";
|
||||
const globPatterns = [ join(rootDir, "**/*.md") ];
|
||||
const configPath = join(rootDir, ".markdownlint-cli2.jsonc");
|
||||
const ignoreRes = [ /^test-repos\/dotnet-docs\/docs\/core\/compatibility\/core-libraries\/5.0\/code-access-security-apis-obsolete.md: \d+: MD033\/.*$\r?\n?/gm ];
|
||||
return lintTestRepo(t, globPatterns, configPath, ignoreRes);
|
||||
return lintTestRepo(t, globPatterns, configPath);
|
||||
});
|
||||
|
||||
test("https://github.com/electron-electron", (t) => {
|
||||
|
|
|
@ -16645,6 +16645,38 @@ Generated by [AVA](https://avajs.dev).
|
|||
'no-inline-html',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Element: details',
|
||||
errorRange: [
|
||||
1,
|
||||
9,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 109,
|
||||
ruleDescription: 'Inline HTML',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md033.md',
|
||||
ruleNames: [
|
||||
'MD033',
|
||||
'no-inline-html',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Element: details',
|
||||
errorRange: [
|
||||
2,
|
||||
9,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 116,
|
||||
ruleDescription: 'Inline HTML',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md033.md',
|
||||
ruleNames: [
|
||||
'MD033',
|
||||
'no-inline-html',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Detailed HTML Results␊
|
||||
␊
|
||||
|
@ -16753,6 +16785,17 @@ Generated by [AVA](https://avajs.dev).
|
|||
Nor <123abc>.␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<details>␊
|
||||
␊
|
||||
{MD033:109}␊
|
||||
␊
|
||||
<details>␊
|
||||
␊
|
||||
- Item␊
|
||||
<details>␊
|
||||
␊
|
||||
{MD033:116}␊
|
||||
`,
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue