Render diffs and code, now with edit

@pierre/diffs is an open source diff and code rendering library. Rich syntax highlighting, edit mode, support for custom and Shiki themes, virtualization, and more. Made by The Pierre Computer Company.

Documentation

Currently v1.6.4

Introducing

Highlights

Super-fast syntax highlighting for code and diffs, written from the ground up to be nearly 300× faster than Shiki. Now in beta.

Get started

Edit diffs and code

Enable edit mode in any File or FileDiff component with the EditProvider. Includes support for selection management, auto-indention, undo history, find-in-file, lint markers, and more. Pairs nicely with @pierre/trees for AUI style experiences. Learn more about edit mode.

Diff layout styles

Choose from stacked (unified) or split (side-by-side). Both use CSS Grid and Shadow DOM under the hood, meaning fewer DOM nodes and faster rendering.

Choose how changes are styled

Your diffs, your choice. Render changed lines with classic diff indicators (+/–), full-width background colors, or vertical bars. You can even highlight inline changes—character or word based—and toggle line wrapping, hide numbers, and more.

Merge conflict resolution UI

Render conflicts through a dedicated diff primitive that treats current and incoming sections as structured additions/deletions without running text diffing. Resolve by choosing current, incoming, or both changes and preview the updated file instantly.

Comments & Annotations

@pierre/diffs provide a flexible annotation framework for injecting additional content and context. Use it to render your own line comments, annotations from CI jobs, and other third-party content.

Y
You3h

Should we validate the role parameter? We could restrict it to a set of allowed values.

A
Amadeus2h

Good idea, maybe use a Literal type or an enum.

M
Mark2h

Agreed, we should also update verify_token to return the role.

Accept/Reject Changes

Annotations can also be used to build interactive code review interfaces similar to AI-assisted coding tools like Cursor. Use it to track the state of each change, inject custom UI like accept/reject buttons, and provide immediate visual feedback.