npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

html-scan

v1.0.2

Published

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/hal2dy/html-scan/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/hal2dy/html-scan/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/hal2dy/html-scan/badges/build.png?b=

Readme

html-scan

Scrutinizer Code Quality Build Status Coverage Status Build Status

A simple html scan, Pre-defined some simple rules to detect SEO. Easy to define more rule

Features

Scan a HTML file and show all of the SEO defected

Pre-defined rules

  1. Detect if there are any <img /> tags without alt attribute

  2. Detect if there are any <a /> tags without rel attribute

  3. In <head> tag

    • Detect if there is any header that doesn’t have <title></title> tag
    • Detect if there is any header that doesn’t have <meta name="descriptions" ... /> tag
    • Detect if there is any header that doesn’t have <meta name="keywords" ... /> tag
  4. Detect if there are more than 15 <strong> tag in HTML (15 is a value should be configurable by user)

  5. Detect if a HTML have more than one <h1> tag.

Support Input

  • HTML file
  • Node Readable Stream

Support Output

  • File
  • Node Writable Stream
  • Console

Installation

  • Using yarn yarn add --dev html-scan

  • Using npm npm install --save-dev html-scan

Usage

Input

  1. Can be a string: path to input file
const scan = require('html-scan')

scan('test/sample.html', output, options)
  1. Can be a node Readable
const Readable = require('stream').Readable

const scan = require('html-scan')

const readStream = new Readable()
readStream._read = () => {} // To prevent cash when not implement _read
readStream.push('input data')
scan(readStream, output, options)

Output

  1. Can be a null value, result will be print to console.log()
const scan = require('html-scan')

scan(input, null, options)
  1. Can be a string: path to output file
const scan = require('html-scan')

scan(input, 'test/output.txt', options)
  1. Can be a node Writeable
const fs = require('fs')

const scan = require('html-scan')

const writeStream = fs.createWriteStream('test/output.txt')
scan(input, writeStream, options)

Options

To override the default config

{
    rules: {
        h1: { threadhold: 1 },
        strong: { threadhold: 15 }
    },
    order: ['a', 'h1', 'head', 'img', 'strong'],
    path: 'rules'
}
  • rules (object): Extra parameter which will send to the rule. The object key must exactly the same with rule name
  • order (array): An array that define the order of rule will going to run. If any rule that not list in here, it will Not run
  • path (string): path to defined rules

Add more rule

Simply add an module to rules directory

module.exports = ($, options) => {
  ...
  if (...) {
      return 'Message here...'
  } else {
      return null
  }
}
  • $ is a Cheerio object
  • options is extra paramenter for the rule in config

Contributing

  • Pass all tests yarn test