sylvaindumont / markuplint

HTML linter for legacy/modern HTML, Web Components, SVG, MathML, AMP HTML and more.

Home Page:https://markuplint.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

markuplint

npm version Build Status Coverage Status

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 pathes (glob format)>
	$ <stdout> | markuplint

Options
	--ruleset,      -r FILE_PATH  Ruleset file path.
	--no-color,     -c            Output no color.
	--format,       -f FORMAT     Output format. Support "JSON" or "Simple". Default "JSON".
	--problem-only, -p            Output only problems, without passeds.

	--help,         -h            Show help.
	--version,      -v            Show version.

Examples
	$ markuplint verifyee.html --ruleset path/to/.markuplintrc
	$ cat verifyee.html | markuplint

Screen shot

API

import * as markuplint from 'markuplint';

const reports = await markuplint.verify(html, ruleset, rules);
// or
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 Customization

Editor Extensions

Editor Page Author
Visual Studio Code @YusukeHirao
Atom @YusukeHirao
Vim @heavenshell

Thanks

This linter is inspired by:

About

HTML linter for legacy/modern HTML, Web Components, SVG, MathML, AMP HTML and more.

https://markuplint.github.io/

License:MIT License


Languages

Language:TypeScript 53.2%Language:JavaScript 46.1%Language:HTML 0.6%