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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vorna-group/tencparser

v0.1.4

Published

TENC (Token Efficient Nested Codec) parser, validator, repair, and converters.

Downloads

609

Readme

tenc-parser

TENCparser — reference-quality utilities for TENC (Token Efficient Nested Codec):

  • Parse TENC → AST
  • Validate AST and source (escaping, primary rules, dictionaries)
  • Repair near‑valid TENC strings
  • Convert TENC → HTML (string serializer)
  • Convert HTML → TENC

TENC Documentation

Released by Vorna Group LLC. Conceived and implemented by Felix Orlov and Nick Medved.

Install

npm install @vorna-group/tencparser

Usage

Parse and validate

import { parseTenc, validateAst } from "@vorna-group/tencparser";

const src = '<a@https://example.com Hello>';
const { ast, dicts } = parseTenc(src);
const diags = validateAst(ast, src, { escapeChecks: true, dicts });
if (diags.length) {
  console.error(diags);
}

Repair

import { fixTenc } from "@vorna-group/tencparser";

const { fixed, string } = fixTenc('<p Hello'); // missing '>'
// fixed === true; string === '<p Hello>'

TENC → HTML

import { convertTencToHtml } from "@vorna-group/tencparser";

const html = convertTencToHtml('<a@https://example.com Hello>');
// <a href="https://example.com">Hello</a>

HTML → TENC

import { convertHtmlToTenc } from "@vorna-group/tencparser";

const tenc = convertHtmlToTenc('<a href="https://example.com">Hello</a>');
// '<a@https://example.com Hello>'

Works in browsers (DOMParser) and in Node.js (built‑in parse5).

API

  • parseTenc(input: string): { ast: TencNode[]; dicts: Record<string,Record<string,string>> }
  • validateAst(ast: TencNode[], source?: string, opts?): Diagnostic[]
  • fixTenc(input: string, opts?): { fixed: boolean; string: string }
  • astToHtml(ast: TencNode[], opts?): string (low-level)
  • convertTencToHtml(src: string, opts?): string
  • convertHtmlToTenc(input: string|Element|Document|DocumentFragment, opts?): string
  • defaultPrimaryMap, createPrimaryMap(override)
  • indexToLineCol(input, index)

Types: see dist/index.d.ts.

Notes

  • The HTML → TENC converter supports both browsers (DOMParser) and Node.js (parse5). You can pass a string or a DOM node (Document/Element/DocumentFragment).
  • The validator enforces the TENC 0.3 rules, including @primary precedence and required escaping (<, >, (, ), #, @, \\, %), and forbids dictionary references in TEXT.
  • Inline <script> and <style> are ignored. External resources are included: <script src="..."> and <link rel="stylesheet" href="...">.

License

This library is source‑available and free for entities with annual gross revenue under USD $150,000. Otherwise, please contact [email protected] for a commercial license. See LICENSE for details.