๐ A robust HTML file statistics collector, analyzer and validator
npm install scanhtml --save
yarn add scanhtml --save
import scanhtml from 'scanhtml';
// or const scanhtml = require('scanhtml');
const html = `
<!doctype html>
<html>
<head>
<title>A Simple HTML Document</title>
</head>
<body>
<p>This is a very simple HTML document</p>
<p>It only has two paragraphs</p>
</body>
</html>
`;
// Switching off some metrics
const report = scanhtml(
html,
{
svgElements: false,
mathmlElements: false,
customElements: false,
svgAttributes: false,
}
);
NOTE: Without provided options object scanhtml
will use defaults. See available Options.
See Report Structure for more details.
See examples folder with stylesheets and their corresponding reports.
Use this flag to fill .size
metric
- Default:
true
Use this flag to fill .elements
metric
-
NOTE: Disabling this flag you will disable counting of all html elements
-
Default:
true
Use this flag to fill .elements.void
metric
- Default:
true
Use this flag to fill .elements.svg
metric
- Default:
true
Use this flag to fill .elements.mathml
metric
- Default:
true
Use this flag to fill .elements.obsolete
metric
- Default:
true
Use this flag to fill .elements.custom
metric
- Default:
true
Use this flag to fill .attributes
metric
-
NOTE: Disabling this flag you will disable counting of all html attributes
-
Default:
true
Use this flag to fill .attributes.global
metric
- Default:
true
Use this flag to fill .attributes.id
metric
- Default:
true
Use this flag to fill .attributes.style
metric
- Default:
true
Use this flag to fill .attributes.data
metric
- Default:
true
Use this flag to fill .attributes.aria
metric
- Default:
true
Use this flag to fill .attributes.svg
metric
- Default:
true
Use this flag to fill .attributes.obsolete
metric
- Default:
true
MIT ยฉ Alex Orekhov @everget