Update MD044/proper-names to add html_elements parameter (fixes #435).

This commit is contained in:
David Anson 2022-04-25 21:50:33 -07:00
parent 8afec14376
commit 0f845e9ba1
15 changed files with 186 additions and 14 deletions

View file

@ -1283,3 +1283,43 @@ test("forEachLink", (t) => {
t.is(matches.length, 0, "Missing match");
}
});
test("htmlElementRanges", (t) => {
t.plan(1);
const params = {
"lines": [
"# Heading",
"",
"Text text text",
"text <a id='id'/> text",
"text text text",
"",
"<p>",
"Text <em>text</em> text",
"</p>",
"",
"```",
"<br/>",
"```",
"",
"Text `<br/>` text",
"text <br/> text"
],
"tokens": [
{
"type": "code_block",
"map": [ 10, 12 ]
}
]
};
const expected = [
[ 3, 5, 12 ],
[ 6, 0, 3 ],
[ 7, 5, 4 ],
[ 14, 6, 5 ],
[ 15, 5, 5 ]
];
const lineMetadata = helpers.getLineMetadata(params);
const actual = helpers.htmlElementRanges(params, lineMetadata);
t.deepEqual(actual, expected);
});

View file

@ -0,0 +1,10 @@
{
"default": true,
"MD033": false,
"MD044": {
"names": [
"JavaScript"
],
"html_elements": false
}
}

View file

@ -0,0 +1,21 @@
# Proper Names No HTML
Okay text JavaScript.
Bad text javascript. {MD044}
Bad code `javascript`. {MD044}
<img src="img/javascript/image.png">
<script type="text/javascript">
javascript {MD044}
</script>
<a id="javascript">
<a id="javascript"/>
<javascript/>
<code>javascript</code>

View file

@ -1,5 +1,6 @@
{
"default": true,
"MD033": false,
"MD044": {
"names": [
"markdownlint",

View file

@ -40,7 +40,7 @@ Code in `javascript` {MD044}
Execute `via the node.js engine` {MD044}
HTML <u>javascript</u> {MD033} {MD044}
HTML <u>javascript</u> {MD044}
* Use NPM {MD044}
@ -84,3 +84,12 @@ Text referencing multiplecase name.
Text referencing MultipleCase name.
Text referencing MULTIPLECASE name. {MD044}
Text referencing mULTIPLEcASE name.
<img src="img/javascript/image.png" error="{MD044}">
<script type="text/javascript">
{MD044:90}
javascript {MD044}
</script>
<a error="{MD044}" id="javascript"/>