Convert Newlines to Hard Breaks in mdast

JSON →
library 2.0.0 ·javascript
verified May 27, 2026

mdast-util-newline-to-break is a utility for the unified ecosystem that transforms soft line endings (simple newlines) in an mdast syntax tree into hard break (<br>) nodes. This is particularly useful for rendering user-authored content where line breaks should visually translate to actual line breaks, mimicking GitHub's behavior in comments or issues. The current stable version is 2.0.0. As part of the unified collective, it maintains compatibility with actively supported Node.js versions, with major releases typically coinciding with Node.js LTS updates. Unlike standard Markdown, which requires two trailing spaces or a backslash for a hard break, this utility provides a more direct conversion. It is often used internally by higher-level plugins like `remark-breaks`.

total hits 15
actors 7 distinct systems
last hit 1d ago human
MetaBot
4
GPTBot
2
Script
1
ClaudeBot
1
Search engines
1
Humans
1

top countries 🇺🇸 United States · 🇨🇦 Canada · 🇺🇦 Ukraine · 🇬🇧 United Kingdom · 🇩🇪 Germany