Socket
Book a DemoInstallSign in
Socket

posthtml-lint

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthtml-lint

PostHTML plugin to lint static markup

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

posthtml-lint

NPM Deps Build Coverage

Changelog

posthtml-lint is a PostHTML plugin to lint static markup.

Currently supported rules include no-duplicate-ids, no-duplicate-tags, no-empty-tags and no-missing-attributes.

Before:

<head>
  <title>Title</title>
  <title>Title</title>
</head>
<body>
  <a>Link</a>
</body>

After:

# Output printed to the terminal
There are ...

Install

yarn add -D posthtml-lint
# OR
npm i posthtml-lint

Usage

const fs = require('fs');
const posthtml = require('posthtml');
const { lint } = require('posthtml-lint');

const html = fs.readFileSync('./index.html');

posthtml()
  .use(lint())
  .process(html)
  .then(result => fs.writeFileSync('./after.html', result.html));

Options

NameKindDescription
noDuplicateIdsboolean (default true)Disallow duplicate ids
noDuplicateTagsboolean (default true)Disallow duplicate occurrences of the html, head, title and body tags
noEmptyTagsboolean (default true)Disallow empty tags for tags that are not self-closing
noMissingAttributesboolean (default true)Disallow tags with missing required attributes.

Contributing

See PostHTML Guidelines and contribution guide.

License

MIT

Keywords

html

FAQs

Package last updated on 21 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts