mdast-util-to-markdown is a low-level utility that converts an mdast syntax tree into serialized markdown text. It is useful when you want to handle syntax trees directly, or build custom markdown serialization by pairing it with other mdast utilities and handlers.
Project status
- The source is a markdown serialization utility for mdast, with a patch-level update history (latest documented updates are 2.1.2 on 2024-11-04, and there was an upstream push on 2026-04-24). The long gap since the last published update suggests it is likely stable, but maintenance is not clearly continuous from releases alone.
- Update cadence appears slow, with the documented version updates spaced months to years apart (2.1.2 in 2024, 2.1.1 in 2024, then the prior changes in 2023, and earlier 2021). Relative to today (2026-06-09), there have been no documented published updates since 2024-11-04.
AI summary generated
Recent updates
2.1.2
Release 2.1.2 is a small patch release focused on fixing a crash in more complex content involving attention. The code change guards against reading the last item from an empty results array in the container phrasing utility.
2.1.1
Release 2.1.1 focuses on fixing “attention” roundtripping (emphasis and strong) by encoding the surrounding characters so the produced markdown keeps parsing the same emphasis boundaries. In addition, it performs a TypeScript typing refactor (switching to `@import`s, reorganizing declaration files, and adding declaration maps).
2.1.0
Release 2.1.0 introduces a new `compilePattern` helper that is made available on the serialization `state`, and updates internal code paths to use it for compiling unsafe patterns. It also includes a small set of tooling dependency bumps (format/lint related).
Features2.0.0
mdast-util-to-markdown 2.0.0 is a major release that targets Node.js 16+, updates the project to use an exports map, and changes several serialization defaults (fenced code, list item indentation). The code diff also shows broader internal refactors around mdast v4 typing (Nodes/Parents) and significant dependency major version upgrades, beyond what is explicitly detailed in the release notes.
Breaking1.5.0
Version 1.5.0 refactors the serializer internals from a `Context` object to a `State` object, and adds several convenience helpers on that state. It also fixes spacing behavior for roots that contain phrasing content, and improves the public TypeScript surface (including a construct name registry).
Features1.4.0
Release 1.4.0 primarily changes how mdast-util-to-markdown escapes punctuation, reducing unnecessary escaping for `-`, `*`, and `+` in certain contexts. The diff also includes internal typing and handler-dispatch changes (not mentioned in the release notes) that can affect extension authors who implement custom handlers.
Breaking1.3.0
Release 1.3.0 adds output position tracking support and updates project documentation. The code changes show a new internal tracking mechanism (util/track.js) that is threaded through many markdown handle functions so the serializer can compute where content is emitted in the output.
Features1.2.6
Release 1.2.6 is a small patch that claims to fix a bug where lists could collapse into thematic breaks. The code diff shows an adjustment to the list rendering marker selection logic and corresponding test coverage updates for nested empty list items.
1.2.5
Release 1.2.5 updates mdast-util-to-markdown to better handle control characters in destination URLs when serializing definition, link, and image nodes. It adds targeted tests for URLs containing a form feed character (\f) and adjusts the logic that decides when destination URLs must be enclosed in angle brackets.
1.2.4
Release 1.2.4 is described as a small fix to avoid escaping certain characters in specific markdown “spans”. The code diff shows this is implemented by changing the escaping “unsafe” rules in lib/unsafe.js and adding new tests that assert no escaping occurs for characters inside link destinations, reference identifiers, and link titles.