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

@advance-labs/html-parser

v0.2.2

Published

Pure HTML extraction for the AEO Toolkit — meta/OG/Twitter, headings, images, links, content signals, and raw structured-data blocks. No network.

Readme

@advance-labs/html-parser

Pure, synchronous HTML extraction for the AEO Toolkit. Given an HTML string and the URL it came from, it produces the shared ParsedHtml shape: document meta, OpenGraph and Twitter cards, the heading tree, images with alt coverage, internal/external links, content-quality signals (word count, FAQ/HowTo, question headings, structure counts), and raw structured-data blocks. No network and no filesystem access — fetching is the job of @advance-labs/crawler, and full schema.org validation is the job of @advance-labs/schema-validator; this package only collects the raw blocks they need.

Usage

import { parseHtml } from '@advance-labs/html-parser';

const parsed = parseHtml(htmlString, 'https://example.com/page');

console.log(parsed.meta.title, parsed.meta.titleLength);
console.log(parsed.openGraph.complete);
console.log(parsed.imageAltCoverage); // 0..1
console.log(parsed.content.hasFaq, parsed.content.questionHeadingCount);
console.log(parsed.rawStructuredData); // [{ format: 'json-ld', data: {...} }, ...]

Each extractor is also exported standalone (accepting an HTML string), so a consumer can pull a single signal without parsing the whole document:

import { extractMeta, extractHeadings } from '@advance-labs/html-parser';

const meta = extractMeta(htmlString, url);
const headings = extractHeadings(htmlString);

Public API

| Export | Signature | Purpose | | --- | --- | --- | | parseHtml | (html: string, url: string) => ParsedHtml | Full extraction into the shared shape. | | extractMeta | (html: string, url: string) => MetaTags | Title/description (+lengths), canonical, robots, viewport, charset, lang, theme-color. | | extractOpenGraph | (html: string, url: string) => OpenGraph | OG tags; complete requires the og title/description/image/url quartet. | | extractTwitter | (html: string, url: string) => TwitterCard | Twitter card tags (accepts name= and property=). | | extractHeadings | (html: string) => HeadingNode[] | Heading tree h1–h6 in document order. | | extractImages | (html: string, url: string) => ImageInfo[] | <img> with resolved src, hasAlt, dimensions. | | extractLinks | (html: string, url: string) => LinkInfo[] | Anchors classified internal/external + nofollow. | | computeContentSignals | (html: string) => ContentSignals | Word count, FAQ/HowTo, question headings, paragraph/list/table counts. | | extractRawStructuredData | (html: string) => RawStructuredDataBlock[] | JSON-LD parsed; microdata/RDFa presence markers. | | isHeadingHierarchyValid | (headings: HeadingNode[]) => boolean | True when headings never skip a level downward. | | imageAltCoverage | (images: ImageInfo[]) => number | Fraction of images with alt text, 0..1. | | internalLinkCount / externalLinkCount | (links: LinkInfo[]) => number | Link counts by classification. | | isQuestionHeading | (text: string) => boolean | Whether a heading reads as a question. | | jsonLdHasType / collectJsonLdTypes | see source | JSON-LD @type inspection helpers. |

All shapes are imported from @advance-labs/types; this package never redefines them.

Notes

  • hasFaq is set when an FAQ-flavored heading is present or an FAQPage/QAPage JSON-LD block exists. hasHowTo likewise combines headings and HowTo JSON-LD.
  • An empty alt="" counts as not having descriptive alt text.
  • Relative URLs in canonical, og:image, twitter:image, <img src>, and <a href> are resolved against the supplied page URL. Fragment-only (#...) anchors are skipped.
  • Malformed JSON-LD is silently skipped (it surfaces as a validation finding downstream, not a parser crash).

Status

Implemented. All extractors are real (cheerio-backed) with no network/filesystem dependency and no stubs. Unit-tested with rich-page and sparse-page fixtures.