rehype-raw

A rehype plugin that reparses embedded raw HTML in a hast tree so it becomes real syntax nodes.

Library
npm
v7.0.0
209stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
38/100Needs Attention
Development Activity0
Maintenance20
Community52
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture88
Code Quality90
Innovation85
Learning Curve60

rehype-raw is a unified/rehype plugin that takes a hast (HTML AST) tree containing strings of raw HTML and reparses it through the parse5 HTML parser, recreating the tree exactly as a browser would while preserving the original data and positional information. It is the standard bridge for pipelines that come from markdown with embedded HTML: after remark-rehype passes HTML through as opaque raw nodes, rehype-raw turns those strings into actual element nodes so downstream plugins, and output formats like React or MDX, can operate on a proper tree instead of unparseable HTML strings.

What You Get

  • A single default-export rehype plugin you drop into a unified().use(...) chain
  • Accurate reparsing of embedded raw HTML into hast element nodes via the parse5 browser-grade parser
  • Preserved positional information (line/column data) across the reparse
  • An optional GFM tagfilter mode to neutralize dangerous tags like script, iframe, and style
  • A passThrough option to keep specified custom node types untouched during reparsing
  • Full TypeScript types (ESM-only, ships an Options type)

Common Use Cases

  • Rendering markdown that contains inline HTML to React or MDX components
  • Running rehype transform plugins over content that mixed in raw HTML blocks
  • Producing a clean HTML AST from remark-rehype output generated with allowDangerousHtml: true
  • Applying GFM tagfilter rules to block irregular or unsafe tags in user-authored HTML

Under The Hood

Architecture

The package is intentionally thin. The public entry index.js re-exports the default from lib/index.js, which defines a single rehypeRaw(options) factory. That factory returns a unified transformer (tree, file) that delegates all real work to raw() from hast-util-raw, spreading the caller’s options and injecting the current file so positional/message context is preserved. hast-util-raw in turn runs the tree through parse5, so the tree is reconstructed exactly as a browser HTML parser would build it. The plugin itself owns no parsing logic — it is a well-scoped adapter that wires rehype’s plugin contract onto the underlying hast utility.

Tech Stack

Written in modern ESM JavaScript targeting Node.js 16+, with types authored as JSDoc and emitted to .d.ts via the TypeScript compiler (tsc --build). Runtime dependencies are minimal and current: hast-util-raw ^9, @types/hast ^3, and vfile ^6. Tooling includes xo + prettier for lint/format, remark-cli with remark-preset-wooorm for docs, c8 for coverage, and type-coverage enforcing 100% typed code. There is no bundler — the package ships source ESM directly.

Code Quality

Code quality is high for a micro-package. type-coverage is pinned at 100% with strict TypeScript checking of JS, and the tsconfig enables strict and exactOptionalPropertyTypes. test.js uses the built-in node:test runner with node:assert/strict and covers the public API surface, the core markdown-with-embedded-HTML reparse case, and the tagfilter behavior; the CI test script requires 100% coverage via c8 --100. Naming and structure are clear, and the single transformer is small enough to reason about completely.

API Design

The API is minimal and idiomatic to unified: a default export you .use() with an optional options object (passThrough, tagfilter). There are no other identifiers to learn, options mirror the underlying hast-util-raw configuration, and the README’s runnable end-to-end example gets a new user productive quickly. The main friction is conceptual rather than ergonomic — using it well requires understanding the hast AST and where reparsing fits in a remark/rehype pipeline.

Used by 39 apps in this directory

TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
TypeScript
48%
AGPL 3.0

Banana Slides

AI Design Tools · Productivity

15,476

AI-native PPT generator with Vibe editing, multi-LLM support, and fully editable PPTX export

View details
83
Repo Health
82
Technical
71
Dependency
Built with
TypeScript48%
Python47%
Updated 3 days ago
TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

10,880

A self-hosted, AI-powered card note-taking tool that lets you capture fleeting thoughts instantly and retrieve them with natural language search.

View details
83
Repo Health
69
Technical
65
Dependency
Built with
TypeScript92%
Updated 2 weeks ago
Go
76%
AGPL 3.0

Coder

Devops · Developer Tools · Code Editors

14,199

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
93
Repo Health
90
Technical
71
Dependency
Built with
Go76%
TypeScript22%
Updated today
TypeScript
84%
Apache 2.0

Continue

Developer Tools · AI Development · AI Code Assistants

35,532

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
87
Repo Health
88
Technical
65
Dependency
Built with
TypeScript84%
Updated today
Rust
66%
Other

DefGuard

Security · Networking · Authentication

2,805

Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.

View details
85
Repo Health
82
Technical
77
Dependency
Built with
Rust66%
TypeScript32%
Updated today
TypeScript
88%
MIT

DevTools-X

Developer Tools

1,532

41 offline-first developer utilities in a single 10MB cross-platform desktop app — no Electron, no cloud, no compromise.

View details
51
Repo Health
68
Technical
68
Dependency
Built with
TypeScript88%
Updated 2 months ago
Python
79%
GPL 3.0

ERPNext

ERP · Invoicing Finance

38,251

100% free, open-source ERP unifying accounting, manufacturing, inventory, CRM, HR, and POS in a single self-hostable platform.

View details
96
Repo Health
77
Technical
75
Dependency
Built with
Python79%
JavaScript14%
Updated today
TypeScript
96%

Finance

AI Assistants · Invoicing Finance

890

Bloomberg-grade financial data and AI-powered analysis through a conversational chat interface you can self-host.

View details
62
Repo Health
62
Technical
71
Dependency
Built with
TypeScript96%
Updated 1 weeks 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

Search