diffs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese@pierre/diffs
@pierre/diffs@pierre/diffs
@pierre/diffsUse to render syntax-highlighted files and diffs. Use its
optional editor, SSR, and worker entries for those capabilities.
@pierre/diffs使用渲染带语法高亮的文件和差异对比内容。可使用其可选的编辑器、SSR和worker入口来实现对应功能。
@pierre/diffsInstall
安装
bash
pnpm add @pierre/diffsInstall and when the app uses the React entry.
reactreact-dombash
pnpm add @pierre/diffs如果应用使用React入口,请安装和。
reactreact-domSelect an API reference
选择API参考文档
| Surface | Reference |
|---|---|
| Root components, parsing, and file extension APIs | Core API |
| Languages, themes, highlighter state, and streams | Highlighting API |
| Renderers, managers, DOM helpers, comparisons, and constants | Low-level rendering API |
| Shared data, option, render, selection, and editor types | Shared types |
| React API |
| Editor API |
| SSR API |
| Worker API |
| 功能模块 | 参考文档 |
|---|---|
| 根组件、解析和文件扩展API | 核心API |
| 语言、主题、高亮器状态和流 | 高亮API |
| 渲染器、管理器、DOM辅助工具、对比功能和常量 | 底层渲染API |
| 共享数据、选项、渲染、选择和编辑器类型 | 共享类型 |
| React API |
| 编辑器API |
| SSR API |
| Worker API |
Select a recipe
选择使用示例
| Task | Recipe |
|---|---|
| Render a file or diff in React | Render with React |
| Render a file or diff without React | Render with vanilla JavaScript |
| Build a virtualized review surface | Use CodeView |
| Edit a React surface or CodeView | Edit with React |
| Edit a vanilla surface or CodeView | Edit with vanilla JavaScript |
| Preload markup on the server | Use SSR |
| Highlight through a worker pool | Use workers |
| Add line annotations and selection | Add annotations and selection |
| Register a Shiki language or theme | Register custom highlighting |
| 任务 | 示例文档 |
|---|---|
| 在React中渲染文件或差异对比内容 | 使用React渲染 |
| 不使用React渲染文件或差异对比内容 | 使用原生JavaScript渲染 |
| 构建虚拟化评审界面 | 使用CodeView |
| 编辑React界面或CodeView | 使用React编辑 |
| 编辑原生界面或CodeView | 使用原生JavaScript编辑 |
| 在服务器端预加载标记 | 使用SSR |
| 通过worker池实现高亮 | 使用workers |
| 添加行注释和选择功能 | 添加注释和选择功能 |
| 注册自定义Shiki语言或主题 | 注册自定义高亮 |