mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Update MD044/proper-names to parse into micromark htmlFlow tokens for better behavior when html_elements is false (fixes #832).
This commit is contained in:
parent
8cb6b8eff5
commit
b1eff75034
8 changed files with 386 additions and 25 deletions
|
|
@ -52,6 +52,9 @@ function createTestForFile(file) {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (const list of Object.values(expected)) {
|
||||
list.sort();
|
||||
}
|
||||
const actual = {};
|
||||
for (const error of errors) {
|
||||
const rule = error.ruleNames[0];
|
||||
|
|
@ -65,6 +68,9 @@ function createTestForFile(file) {
|
|||
`Fixable rule ${rule} is not tagged as such.`
|
||||
);
|
||||
}
|
||||
for (const list of Object.values(actual)) {
|
||||
list.sort();
|
||||
}
|
||||
t.deepEqual(actual, expected, "Too few or too many issues found.");
|
||||
// Create snapshot
|
||||
const fixed = helpers.applyFixes(content, errors)
|
||||
|
|
|
|||
|
|
@ -20,16 +20,33 @@ javascript {MD044}
|
|||
|
||||
<code>javascript</code> {MD044}
|
||||
|
||||
<div>javascript</div> {MD044}
|
||||
|
||||
<!-- javascript -->
|
||||
|
||||
<!--
|
||||
javascript
|
||||
-->
|
||||
|
||||
<a href="https://example.org">
|
||||
|
||||
<div><a href="https://example.org"></div>
|
||||
|
||||
<div>
|
||||
<a href="https://example.org">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
javascript {MD044}
|
||||
<a href="https://example.org">
|
||||
javascript {MD044}
|
||||
</div>
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"MD033": false,
|
||||
"MD044": {
|
||||
"names": [
|
||||
"HTTPS",
|
||||
"JavaScript"
|
||||
],
|
||||
"html_elements": false
|
||||
|
|
|
|||
|
|
@ -104,10 +104,27 @@ javascript {MD044}
|
|||
javascript {MD044}
|
||||
-->
|
||||
|
||||
<a href="https://example.org">
|
||||
|
||||
<div><a href="https://example.org"></div>
|
||||
|
||||
<div>
|
||||
<a href="https://example.org">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
javascript {MD044}
|
||||
<a href="https://example.org">
|
||||
javascript {MD044}
|
||||
</div>
|
||||
|
||||
{MD044:107} {MD044:109} {MD044:112} {MD044:117}
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"MD033": false,
|
||||
"MD044": {
|
||||
"names": [
|
||||
"HTTPS",
|
||||
"Internet Explorer",
|
||||
"markdownlint",
|
||||
"multiplecase",
|
||||
|
|
|
|||
|
|
@ -36130,6 +36130,66 @@ Generated by [AVA](https://avajs.dev).
|
|||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: JavaScript; Actual: javascript',
|
||||
errorRange: [
|
||||
6,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 10,
|
||||
editColumn: 6,
|
||||
insertText: 'JavaScript',
|
||||
},
|
||||
lineNumber: 23,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: JavaScript; Actual: javascript',
|
||||
errorRange: [
|
||||
3,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 10,
|
||||
editColumn: 3,
|
||||
insertText: 'JavaScript',
|
||||
},
|
||||
lineNumber: 40,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: JavaScript; Actual: javascript',
|
||||
errorRange: [
|
||||
3,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 10,
|
||||
editColumn: 3,
|
||||
insertText: 'JavaScript',
|
||||
},
|
||||
lineNumber: 42,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Proper Names No HTML␊
|
||||
␊
|
||||
|
|
@ -36153,16 +36213,33 @@ Generated by [AVA](https://avajs.dev).
|
|||
␊
|
||||
<code>JavaScript</code> {MD044}␊
|
||||
␊
|
||||
<div>JavaScript</div> {MD044}␊
|
||||
␊
|
||||
<!-- javascript -->␊
|
||||
␊
|
||||
<!--␊
|
||||
javascript␊
|
||||
-->␊
|
||||
␊
|
||||
<a href="https://example.org">␊
|
||||
␊
|
||||
<div><a href="https://example.org"></div>␊
|
||||
␊
|
||||
<div>␊
|
||||
<a href="https://example.org">␊
|
||||
</div>␊
|
||||
␊
|
||||
<div>␊
|
||||
JavaScript {MD044}␊
|
||||
<a href="https://example.org">␊
|
||||
JavaScript {MD044}␊
|
||||
</div>␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"MD033": false,␊
|
||||
"MD044": {␊
|
||||
"names": [␊
|
||||
"HTTPS",␊
|
||||
"JavaScript"␊
|
||||
],␊
|
||||
"html_elements": false␊
|
||||
|
|
@ -37484,6 +37561,126 @@ Generated by [AVA](https://avajs.dev).
|
|||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: HTTPS; Actual: https',
|
||||
errorRange: [
|
||||
10,
|
||||
5,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 5,
|
||||
editColumn: 10,
|
||||
insertText: 'HTTPS',
|
||||
},
|
||||
lineNumber: 107,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: HTTPS; Actual: https',
|
||||
errorRange: [
|
||||
15,
|
||||
5,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 5,
|
||||
editColumn: 15,
|
||||
insertText: 'HTTPS',
|
||||
},
|
||||
lineNumber: 109,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: HTTPS; Actual: https',
|
||||
errorRange: [
|
||||
12,
|
||||
5,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 5,
|
||||
editColumn: 12,
|
||||
insertText: 'HTTPS',
|
||||
},
|
||||
lineNumber: 112,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: JavaScript; Actual: javascript',
|
||||
errorRange: [
|
||||
3,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 10,
|
||||
editColumn: 3,
|
||||
insertText: 'JavaScript',
|
||||
},
|
||||
lineNumber: 116,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: HTTPS; Actual: https',
|
||||
errorRange: [
|
||||
12,
|
||||
5,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 5,
|
||||
editColumn: 12,
|
||||
insertText: 'HTTPS',
|
||||
},
|
||||
lineNumber: 117,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: JavaScript; Actual: javascript',
|
||||
errorRange: [
|
||||
3,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 10,
|
||||
editColumn: 3,
|
||||
insertText: 'JavaScript',
|
||||
},
|
||||
lineNumber: 118,
|
||||
ruleDescription: 'Proper names should have the correct capitalization',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md044.md',
|
||||
ruleNames: [
|
||||
'MD044',
|
||||
'proper-names',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: indented; Actual: fenced',
|
||||
|
|
@ -37604,10 +37801,27 @@ Generated by [AVA](https://avajs.dev).
|
|||
JavaScript {MD044}␊
|
||||
-->␊
|
||||
␊
|
||||
<a href="HTTPS://example.org">␊
|
||||
␊
|
||||
<div><a href="HTTPS://example.org"></div>␊
|
||||
␊
|
||||
<div>␊
|
||||
<a href="HTTPS://example.org">␊
|
||||
</div>␊
|
||||
␊
|
||||
<div>␊
|
||||
JavaScript {MD044}␊
|
||||
<a href="HTTPS://example.org">␊
|
||||
JavaScript {MD044}␊
|
||||
</div>␊
|
||||
␊
|
||||
{MD044:107} {MD044:109} {MD044:112} {MD044:117}␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"MD033": false,␊
|
||||
"MD044": {␊
|
||||
"names": [␊
|
||||
"HTTPS",␊
|
||||
"Internet Explorer",␊
|
||||
"markdownlint",␊
|
||||
"multiplecase",␊
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue