HAST Node Plain-Text Converter
JSON →hast-util-to-string is a utility within the `unified` ecosystem designed to extract the plain-text value of a `hast` (HTML Abstract Syntax Tree) node. It strictly mimics the DOM's `Node#textContent` getter, returning all textual content regardless of styling or layout, and importantly, it does not interpret HTML elements like `<br>` as introducing newlines. This behavior differentiates it from `hast-util-to-text`, which emulates `Node#innerText` by considering rendered output. The current stable version is 3.0.1. As part of the actively maintained `unified` collective, it follows a release cadence tied to the broader ecosystem, with major versions often introducing updated Node.js requirements (e.g., Node.js 16+ for v3) and migrating to modern JavaScript module practices, including being ESM-only and utilizing package `exports` fields. The library provides comprehensive TypeScript type definitions, ensuring robust development.
Traffic · last 30 days
top countries 🇨🇦 Canada · 🇺🇸 United States · 🇳🇴 Norway · 🇩🇪 Germany · 🇫🇷 France