mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update MD044/proper-names to ignore the content of HTML comments when its html_elements parameter is false (fixes #832).
This commit is contained in:
parent
1b0e783c33
commit
dc4acff067
6 changed files with 68 additions and 2 deletions
|
|
@ -5794,7 +5794,7 @@ module.exports = {
|
||||||
}, function (token) {
|
}, function (token) {
|
||||||
var children = token.children;
|
var children = token.children;
|
||||||
if (!includeHtmlElements && token.type === "htmlFlow") {
|
if (!includeHtmlElements && token.type === "htmlFlow") {
|
||||||
children = children.slice(1, -1);
|
children = children[0] && children[0].text === "<!--" ? [] : children.slice(1, -1);
|
||||||
}
|
}
|
||||||
return children.filter(function (t) {
|
return children.filter(function (t) {
|
||||||
return !ignoredChildTypes.has(t.type);
|
return !ignoredChildTypes.has(t.type);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,9 @@ module.exports = {
|
||||||
(token) => {
|
(token) => {
|
||||||
let { children } = token;
|
let { children } = token;
|
||||||
if (!includeHtmlElements && (token.type === "htmlFlow")) {
|
if (!includeHtmlElements && (token.type === "htmlFlow")) {
|
||||||
children = children.slice(1, -1);
|
children = (children[0] && children[0].text === "<!--") ?
|
||||||
|
[] :
|
||||||
|
children.slice(1, -1);
|
||||||
}
|
}
|
||||||
return children.filter((t) => !ignoredChildTypes.has(t.type));
|
return children.filter((t) => !ignoredChildTypes.has(t.type));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,12 @@ javascript {MD044}
|
||||||
|
|
||||||
<code>javascript</code> {MD044}
|
<code>javascript</code> {MD044}
|
||||||
|
|
||||||
|
<!-- javascript -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
javascript
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- markdownlint-configure-file {
|
<!-- markdownlint-configure-file {
|
||||||
"MD033": false,
|
"MD033": false,
|
||||||
"MD044": {
|
"MD044": {
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,12 @@ javascript {MD044}
|
||||||
|
|
||||||
<a error="{MD044}" id="javascript"/>
|
<a error="{MD044}" id="javascript"/>
|
||||||
|
|
||||||
|
<!-- javascript {MD044} -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
javascript {MD044}
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- markdownlint-configure-file {
|
<!-- markdownlint-configure-file {
|
||||||
"MD033": false,
|
"MD033": false,
|
||||||
"MD044": {
|
"MD044": {
|
||||||
|
|
|
||||||
|
|
@ -36153,6 +36153,12 @@ Generated by [AVA](https://avajs.dev).
|
||||||
␊
|
␊
|
||||||
<code>JavaScript</code> {MD044}␊
|
<code>JavaScript</code> {MD044}␊
|
||||||
␊
|
␊
|
||||||
|
<!-- javascript -->␊
|
||||||
|
␊
|
||||||
|
<!--␊
|
||||||
|
javascript␊
|
||||||
|
-->␊
|
||||||
|
␊
|
||||||
<!-- markdownlint-configure-file {␊
|
<!-- markdownlint-configure-file {␊
|
||||||
"MD033": false,␊
|
"MD033": false,␊
|
||||||
"MD044": {␊
|
"MD044": {␊
|
||||||
|
|
@ -37438,6 +37444,46 @@ Generated by [AVA](https://avajs.dev).
|
||||||
'proper-names',
|
'proper-names',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: JavaScript; Actual: javascript',
|
||||||
|
errorRange: [
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
],
|
||||||
|
fixInfo: {
|
||||||
|
deleteCount: 10,
|
||||||
|
editColumn: 6,
|
||||||
|
insertText: 'JavaScript',
|
||||||
|
},
|
||||||
|
lineNumber: 101,
|
||||||
|
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: [
|
||||||
|
1,
|
||||||
|
10,
|
||||||
|
],
|
||||||
|
fixInfo: {
|
||||||
|
deleteCount: 10,
|
||||||
|
editColumn: 1,
|
||||||
|
insertText: 'JavaScript',
|
||||||
|
},
|
||||||
|
lineNumber: 104,
|
||||||
|
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,
|
errorContext: null,
|
||||||
errorDetail: 'Expected: indented; Actual: fenced',
|
errorDetail: 'Expected: indented; Actual: fenced',
|
||||||
|
|
@ -37552,6 +37598,12 @@ Generated by [AVA](https://avajs.dev).
|
||||||
␊
|
␊
|
||||||
<a error="{MD044}" id="JavaScript"/>␊
|
<a error="{MD044}" id="JavaScript"/>␊
|
||||||
␊
|
␊
|
||||||
|
<!-- JavaScript {MD044} -->␊
|
||||||
|
␊
|
||||||
|
<!--␊
|
||||||
|
JavaScript {MD044}␊
|
||||||
|
-->␊
|
||||||
|
␊
|
||||||
<!-- markdownlint-configure-file {␊
|
<!-- markdownlint-configure-file {␊
|
||||||
"MD033": false,␊
|
"MD033": false,␊
|
||||||
"MD044": {␊
|
"MD044": {␊
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue