Code Monkey home page Code Monkey logo

scanhtml's Introduction

scanhtml

๐Ÿ“Š A robust HTML file statistics collector, analyzer and validator

Build Status Build status codecov Coverage Status

CodeFactor codebeat badge Codacy Badge BCH compliance

npm version npm install size David Known Vulnerabilities

Table of contents

  1. Installation

  2. Usage

  3. Report Structure

  4. Examples

  5. Options

  6. License

Installation

npm install scanhtml --save
yarn add scanhtml --save

Back to top

Usage

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.

Back to top

Report Structure

See Report Structure for more details.

Back to top

Examples

See examples folder with stylesheets and their corresponding reports.

Back to top

Options

size

Use this flag to fill .size metric

  • Default: true

elements

Use this flag to fill .elements metric

  • NOTE: Disabling this flag you will disable counting of all html elements

  • Default: true

voidElements

Use this flag to fill .elements.void metric

  • Default: true

svgElements

Use this flag to fill .elements.svg metric

  • Default: true

mathmlElements

Use this flag to fill .elements.mathml metric

  • Default: true

obsoleteElements

Use this flag to fill .elements.obsolete metric

  • Default: true

customElements

Use this flag to fill .elements.custom metric

  • Default: true

attributes

Use this flag to fill .attributes metric

  • NOTE: Disabling this flag you will disable counting of all html attributes

  • Default: true

globalAttributes

Use this flag to fill .attributes.global metric

  • Default: true

idAttributes

Use this flag to fill .attributes.id metric

  • Default: true

styleAttributes

Use this flag to fill .attributes.style metric

  • Default: true

dataAttributes

Use this flag to fill .attributes.data metric

  • Default: true

ariaAttributes

Use this flag to fill .attributes.aria metric

  • Default: true

svgAttributes

Use this flag to fill .attributes.svg metric

  • Default: true

obsoleteAttributes

Use this flag to fill .attributes.obsolete metric

  • Default: true

License

MIT ยฉ Alex Orekhov @everget

Back to top

scanhtml's People

Contributors

everget avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar

Forkers

avimistry

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.