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

@react-rst/parser

v1.0.0

Published

Zero-dependency reStructuredText parser producing a unist-compatible AST (rstast)

Readme

@react-rst/parser

npm version license

A lightweight, zero-dependency reStructuredText (rST) parser written in pure TypeScript. It transforms rST text into an abstract syntax tree adhering to the unist specification.

Works in all JavaScript environments: Node.js, browsers, Bun, Deno, and edge runtimes (Cloudflare Workers, Vercel Edge).


Installation

npm install @react-rst/parser

Usage

import { parse, formatDiagnostic } from '@react-rst/parser';

const rst = `
Getting Started
===============

Here is a paragraph with **bold** text and a link to Python_.

.. _Python: https://python.org
`;

const { ast, diagnostics } = parse(rst, {
  sourceId: 'docs/getting-started.rst',
});

// The parser never throws exceptions; inspect diagnostics for warnings:
for (const diagnostic of diagnostics) {
  console.warn(formatDiagnostic(diagnostic));
}

console.log(JSON.stringify(ast, null, 2));

Options

parse(content, options?) accepts:

| Option | Type | Default | Description | |---|---|---|---| | sourceId | string | undefined | Source document identifier (e.g. filename) attached to AST nodes and diagnostics. | | idPrefix | string | undefined | Prefix prepended to generated anchor IDs. | | tabWidth | number | 8 | Tab stop width (standard rST uses 8). | | directives | Record<string, DirectiveSpec> | {} | Custom directive parsers. | | roles | Record<string, RoleSpec> | {} | Custom interpreted text role parsers. | | knownDirectives | string[] | [] | List of known directives to prevent emitting RST2001 (unknown directive) warnings. | | knownRoles | string[] | [] | List of known roles to prevent emitting RST4001 (unknown role) warnings. |


Diagnostics & Logging

@react-rst/parser guarantees non-throwing execution. When syntax errors, malformed directives, or unresolved references occur, they are recorded in the diagnostics array:

  • CLI/Console: formatDiagnostic(d) produces a standard greppable line:
    [react-rst] RST1001 warning docs/guide.rst:12:1 Title underline too short: expected 15 characters, got 4
  • Cloud Log Services: Diagnostic objects include code, severity, sourceId, and start/end position offsets, ready for JSON logging to Google Cloud Logging, AWS CloudWatch, or Datadog.

See the full Diagnostics Reference for code definitions (RST1001 through RST9001).


License

MIT © Joshua Lauinger