Diffs

A collection of examples showcasing how you can customize and extend @pierre/diffs.

Custom Header & Footer

Use disableFileHeader: true to completely replace the built-in chrome with your own header, footer, and toolbar.

utils.ts
+5-13
2 hunks
↑↓Navigate⌘CCopy

Hover Actions

Use onLineEnter and onLineLeave callbacks to track hover state, then render contextual actions with renderHoverUtility. Perfect for code review workflows with comment, bookmark, and bug report actions.

AI Code Review

Use annotations to display inline AI suggestions, warnings, and code improvements. Each annotation can have custom actions like accept, dismiss, or apply fix.

2 suggestions remaining

Using non-null assertion on environment variable. Consider adding runtime validation.

const SECRET = process.env.JWT_SECRET;
if (!SECRET) throw new Error('JWT_SECRET not configured');

Consider using a shorter token expiry for better security.

Pull Request Review

Build a complete PR review experience with file navigation, approval tracking, and inline comments. Collapse files, approve changes, and track review progress.

feat: Add error handling to useAuth hook

#42 opened by @developer

+29-82 files
+21-8
+8-0
0 of 2 files approved

Git Blame (GitLens Style)

Use onLineEnter and onLineLeave to track hover state, then render blame info with renderHoverUtility. Displays author, commit message, and timestamp - just like GitLens in VS Code.

The onLineEnter callback updates React state with the hovered line number. This triggers a re-render, and renderHoverUtility uses that state to look up blame data and render an inline tooltip. In a real app, you'd fetch this from your git provider's API.