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

@nan0web/html

v0.2.1

Published

HTML transformer and utilities.

Readme

@nan0web/html

HTML utilities for nan0web ecosystem.

|Status|Documentation|Test coverage|Features|Npm version| |---|---|---|---|---| |🟢 99.8% |🧪 English 🏴󠁧󠁢󠁥󠁮󠁧󠁿Українською 🇺🇦 |🟢 100.0% |✅ d.ts 📜 system.md 🕹️ playground |0.2.0 |

Installation

How to install with npm?

npm install @nan0web/html

How to install with pnpm?

pnpm add @nan0web/html

How to install with yarn?

yarn add @nan0web/html

Basic usage – encode nano to HTML

How to encode a simple nano object?

import { HTMLTransformer } from "@nan0web/html"
const transformer = new HTMLTransformer({ eol: "\n", tab: "\t" })
const nano = {
	div: {
		h1: "Hello World",
		p: "This is a paragraph"
	}
}
const result = await transformer.encode(nano)
console.info(result)
// <div>\n\t<h1>Hello World</h1>\n\t<p>This is a paragraph</p>\n</div>

Tag attributes – class and id shortcuts

How to render elements with class and id shortcuts?

import { HTMLTransformer } from "@nan0web/html"
const data = [
	{
		"div.d-flex#main": [
			{ "a.btn.btn-primary": "Button" },
			{ "a#more": "More" },
			{ "a.btn#detail.btn-success": "Detail" }
		]
	}
]
const transformer = new HTMLTransformer({ eol: "", tab: "" })
const result = await transformer.encode(data)
console.info(result)
// <div id="main" class="d-flex"><a class="btn btn-primary">Button</a><a id="more">More</a><a id="detail" class="btn btn-success">Detail</a></div>

Lists – ordered and unordered

How to render ordered list with classes?

import { HTMLTransformer } from "@nan0web/html"
const data = [
	{
		$class: "list-group",
		ol: [
			{ $class: "list-group-item", li: "Item 1" },
			{ $class: "list-group-item", li: "Item 2" }
		]
	}
]
const transformer = new HTMLTransformer({ eol: "", tab: "" })
const html = await transformer.encode(data)
console.info(html)
// <ol class="list-group"><li class="list-group-item">Item 1</li><li class="list-group-item">Item 2</li></ol>

Raw HTML escaping

The escape helper from @nan0web/xml can be used to safely embed text that contains characters with special meaning in HTML.

How to escape raw HTML strings?

import { escape } from "@nan0web/html"
const raw = "<script>alert('xss')</script>"
const escaped = escape(raw)
// &lt;script&gt;alert(&#039;xss&#039;)&lt;/script&gt;

Default HTML5 tags reference

  • defaultHTML5Tags provides a ready‑to‑use instance of HTMLTags
  • with common defaults (e.g. $default = 'p', $selfClosed handling, …). */ How to access default HTML5 tag definitions?
import { defaultHTML5Tags } from "@nan0web/html"
console.info(defaultHTML5Tags)
// HTMLTags {
//   '$attrTrue': '',
//   '$default': 'p',
//   '$nonEmptyTags': [
//     'script',
//     'style'
//   ],
//   '$singleChild': [
//     'tbody'
//   ],
//   '$tagAttrs': {
//     '#': 'id',
//     '.': 'class'
//   },
//   dl: 'dt',
//   ol: 'li',
//   select: 'option',
//   table: 'tr',
//   tr: 'td',
//   ul: 'li'
// }

TypeScript declarations

The package ships with declaration files for a better editor experience.

Uses d.ts files for autocompletion

CLI playground

Run the bundled playground script to see a live demo.

How to run the playground script?

Contributing

How to contribute? - check here

License

How to license ISC? - check here