HTML linter for legacy/modern HTML, Web Components, SVG, MathML, AMP HTML and more.
Install
$ yarn add markuplint
Usage
CLI
$ markuplint verifyee.html
$ markuplint --help
Usage
$ markuplint <HTML file>
$ <stdout> | markuplint
Options
--ruleset, -r Ruleset file path.
--no-color, -c Output no color.
--format, -f FORMAT Output format. Support "JSON" only. Default "JSON".
--help, -h Show help.
--version, -v Show version.
Examples
$ markuplint verifyee.html --ruleset path/to/.markuplintrc
$ cat verifyee.html | markuplint
API
import * as markuplint from 'markuplint';
const reports = await markuplint.verify(html, ruleset, rules);
const { html, reports } = await markuplint.verifyFile(htmlPath, ruleset, rules);
Configuration
.markuplintrc
JSON or YAML format
{
"extends": "markuplint/html-ls",
"rules": {
"rule-name": true,
"rule-name2": false,
"rule-name3": ["error", "VALUE"],
"rule-name4": ["warning", "VALUE", { "OPTIONAL_PROP": "OPTIONAL_VALUE" }]
},
"nodeRules": [
{
"tagName": "div",
"rules": {
"rule-name": false,
}
}
],
"childNodeRules": [
{
"selector": "[data-attr^=\"value\"]",
"inheritance": true,
"rules": {
"rule-name3": ["warning", "ANOTHER_VALUE"],
}
}
]
}
Rules
Rule Documentation (日本語)
Custom Rule Documentation
Editor Extensions
Thanks
This linter is inspired by