@selective/lint
v0.3.0
Published
Apply selective rules to an HTML string
Downloads
1
Maintainers
Readme
Creates a Rehype plugin from JSON rules to check for HTML anti patterns and reports issues back as vFile messages
Installation
# npm
npm install @selective/lint
# yarn
yarn add @selective/lint
Usage
const rehype = require("rehype");
const lint = require("@selective/lint");
const { readFileSync } = require("fs");
rehype()
.use(lint, [
{
name: "img-alt",
description: "image tag must contain an alt property",
recommended: "warn",
selector: "img:not([alt])",
},
])
.process(readFileSync("somefile.html"), (err) => {
console.error(err);
});