CH4ACKO3/dsh-render-engine--packages-diff-render ↗★ 0
@ch4acko3/dsh-diff-render
为 DeepSeek Harness Web 插件提供的语法高亮 HTML Diff 渲染服务。
AI 分析
核心用途是将结构化 Diff 文档渲染为带有语法高亮、清晰标注增删语义的 HTML 视图。适合需要向用户直观展示代码变更差异的 Web 插件开发者。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:CH4ACKO3/dsh-render-engine#8401d60319cc256b73167e14460c12cec647db4f&path:packages/diff-render说明文档
阅读完整 README ↗@ch4acko3/dsh-diff-render
A browser-side Cordis service that renders @ch4acko3/dsh-diff-engine documents as escaped, theme-aware HTML. Diff rows keep their addition, deletion, context, and metadata semantics while source text is highlighted through ctx.syntaxHighlighter when the file language is supported.
export const inject = ['diffEngine', 'diffRenderer']
export function apply(ctx) {
const document = ctx.diffEngine.diff({
kind: 'files',
before: { path: 'app.ts', content: 'const value = 1\n' },
after: { path: 'app.ts', content: 'const value = 2\n' },
})
const result = ctx.diffRenderer.render(document)
console.log(result.html)
}
Complete file snapshots are highlighted as complete sources and mapped back through their old and new line numbers. Patch-only inputs reconstruct each hunk's before and after fragments, so their source-language highlighting is fragment-scoped. Diff state uses row backgrounds and gutters without replacing the source token colors.