rehype

A unified-based HTML processor with a large plugin ecosystem

Library
npm
v13.0.2
2,259 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
50 /100 Fair
Development Activity 16
Maintenance 32
Community 52
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 80
Code Quality 78
Innovation 70
Learning Curve 75

rehype is a unified processor preconfigured with rehype-parse and rehype-stringify, giving you a ready-to-use pipeline for parsing HTML into a HAST syntax tree, running plugins to transform it, and serializing it back to HTML. It is a shortcut for unified().use(rehypeParse).use(rehypeStringify), part of the broader unifiedjs collective alongside remark (Markdown) and retext (prose).

As a monorepo, it also houses rehype-parse, rehype-stringify, and rehype-cli, and anchors a large third-party plugin ecosystem used for HTML linting, sanitization, minification, and static-site content transformation.

What You Get

  • A preconfigured unified processor combining rehype-parse and rehype-stringify
  • A HAST (HTML AST) syntax tree representation for programmatic HTML manipulation
  • Compatibility with the large ecosystem of rehype plugins (sanitize, minify, highlight, etc.)
  • TypeScript types for the processor and its syntax tree
  • A companion rehype-cli package for command-line HTML linting/formatting
  • Interop with remark (Markdown) via remark-rehype for Markdown-to-HTML pipelines

Common Use Cases

  • Transforming HTML content in static site generators (adding IDs to headings, autolinking, etc.)
  • Sanitizing untrusted HTML before rendering it in a web app
  • Linting and auto-formatting HTML files from the command line via rehype-cli
  • Building a Markdown-to-HTML pipeline together with remark and remark-rehype
  • Extracting or rewriting structured data from HTML documents programmatically

Under The Hood

Architecture - The root packages/rehype/index.js composes three sibling packages in the same monorepo: rehype-parse (HTML string to HAST tree), the unified engine (which runs registered plugins over the tree), and rehype-stringify (HAST tree back to an HTML string); rehype-cli sits alongside as a separate consumer of the same processor for command-line use, and the whole ecosystem interops with remark/retext via shared unist-family syntax trees.

Tech Stack - Pure ESM JavaScript ("type": "module") with hand-written .d.ts type declarations, managed as an npm/yarn workspaces monorepo (packages/rehype-parse, packages/rehype-stringify, packages/rehype, packages/rehype-cli), using c8 for coverage, remark-preset-wooorm for internal doc linting, and type-coverage to enforce TypeScript type completeness across the packages.

Code Quality - The monorepo has an extensive test/ directory with parse-error fixtures and syntax-tree assertions via hast-util-assert, plus CI workflows under .github/workflows; the actual rehype package itself is intentionally tiny (a ~10-line index.js), so most complexity and testing responsibility lives in the rehype-parse/rehype-stringify/unified dependencies it composes.

API Design - The processor exposes exactly the unified API (.use(), .process(), .processSync(), .parse(), .stringify()), so anyone familiar with unified/remark can use rehype immediately with zero new concepts to learn; the README explicitly steers users toward using unified directly when they don’t need both parse and stringify, favoring composability over a bespoke convenience API.

Used by 22 apps in this directory

TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 5 days ago
TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 5 days ago
Python
55%
Other

authentik

Authentication · Security

25,758

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
Python 55%
TypeScript 36%
Updated 4 days ago
Python
55%
Other

authentik

Authentication · Security

25,758

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
Python 55%
TypeScript 36%
Updated 4 days ago
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,924

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
94
Repo Health
82
Technical
64
Dependency
Built with
TypeScript 100%
Updated 1 weeks ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

52,202

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
89
Repo Health
84
Technical
70
Dependency
Built with
TypeScript 99%
Updated 4 days ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

52,202

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
89
Repo Health
84
Technical
70
Dependency
Built with
TypeScript 99%
Updated 4 days ago
TypeScript
98%
Apache 2.0

Cline

AI Code Assistants

69,455

An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.

View details
90
Repo Health
74
Technical
65
Dependency
Built with
TypeScript 98%
Updated 4 days ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,787

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript 75%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers