mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-19 13:56:08 +01:00
Update MD044/proper-names to add html_elements parameter (fixes #435).
This commit is contained in:
parent
8afec14376
commit
0f845e9ba1
15 changed files with 186 additions and 14 deletions
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
10
test/proper-names-no-html.json
Normal file
10
test/proper-names-no-html.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD033": false,
|
||||
"MD044": {
|
||||
"names": [
|
||||
"JavaScript"
|
||||
],
|
||||
"html_elements": false
|
||||
}
|
||||
}
|
||||
21
test/proper-names-no-html.md
Normal file
21
test/proper-names-no-html.md
Normal 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>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD033": false,
|
||||
"MD044": {
|
||||
"names": [
|
||||
"markdownlint",
|
||||
|
|
|
|||
|
|
@ -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"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue