Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Release notes — Peisar 2.0.0

Release date: 2026-11-03 · Tag: 2.0.0 · Compare: 1.2.3…2.0.0

Why 2.0.0

Peisar 2.0.0 is the second major release, and it completes the project’s refocus on being a pure Markdown parser. The single-document API is now the only public surface: parsing, HTML rendering, YAML front matter, AST visitors, and custom parser hooks all operate on Markdown strings, with no filesystem, watcher, archive, theme, or site-generation machinery.

The parser and renderer implementations now live in the dedicated peisar_ast and peisar_yaml dependency crates; the peisar package wraps them behind one high-level class for Rust and Node.js.

Highlights

A pure Markdown parser

The cache module is gone, and with it the PeisarCache Node.js class and every filesystem-backed feature: directory walking, file watching, the bincode archive, themes, slugs, pretty URLs, hosting-provider base URLs, and the static-site generation surface. What remains is small, auditable, and fast:

const { Peisar } = require("peisar");

const document = new Peisar("# Hello **world**", { fragment: true });
document.html;        // <h1>Hello <strong>world</strong></h1>\n
document.frontmatter; // parsed YAML or null
document.ast;         // JavaScript AST object
document.astJson;     // AST serialized as JSON

One plugin API

Peisar.use() registers a single plugin object that can carry any combination of visitBlock / visitInline AST visitors and parseBlock / parseInline parser hooks. The deprecated useVisitor() and useParser() aliases are removed.

Registry realignment

npm’s latest release (1.2.3) already ships the peisar_ast / peisar_yaml split, Peisar.use(), and the cache removal, while crates.io stayed at 1.2.2. Version 2.0.0 realigns both registries on the same codebase and marks the single-document API as the 2.x baseline.

Smaller dependency tree

Removing the cache dropped blake3, notify, bincode, libc, and the SIGINT unsafe signal handler from the crate. Peisar now links only the parser, renderer, YAML, and serialization dependencies.

Breaking changes

Removing public APIs requires a major version bump. Consumers upgrading from 1.x should review the following:

Removed in 2.0.0Replacement
new PeisarCache(...), PeisarCache.withConfigJs(...), startWatchingJs(), getPage(), pages(), mapJson(), dispose()None — implement file loading and watching in the host application, then parse each file with the single-document API
frontmatter / theme_dirs / archive / theme APIs on the Rust PeisarCacheNone — same approach: host-side file handling plus the high-level Peisar API
Node.js useVisitor() / useParser()use() with a plugin object
Rust cache types (BaseDirInfo, HostingProvider, PageObject, AssetsObject, …)None

There is no in-package migration path for cache-based consumers: stay on 1.2.x if you depend on those APIs, or re-implement the file-handling layer on top of the single-document parser APIs.

Toolchain: the minimum supported Rust version is now 1.88 (raised from 1.86 to match the updated napi-build dependency). Node.js engine requirements are unchanged.

Full changelog

See CHANGELOG.md for the complete list of changes.

Upgrade steps

  1. Remove PeisarCache usage. Load, watch, and cache files in your application; call new Peisar(markdown, options) per document.
  2. Replace useVisitor(...) / useParser(...) with a single document.use({ visitBlock, visitInline, parseBlock, parseInline }) call. Every field is optional.
  3. Use YAML helpers for front matter outside the class. frontmatter(markdown) returns { cleanContent, yamlData }, and yamlParser / loadYaml parse standalone YAML.
  4. Rust consumers: use peisar::ast and peisar::plugin directly; no module features are required. The npm feature is only needed when building Node.js bindings. See the 2.0.1 release notes for the current Rust API changes.
[dependencies]
peisar = "2.0.0"
const { frontmatter } = require("peisar");
const { cleanContent, yamlData } = frontmatter("---\ntitle: Hello\n---\n# Hi");

Documentation