CH4ACKO3/dsh-render-engine--packages-code-render ↗★ 1

@ch4acko3/dsh-code-render

为 DeepSeek Harness Web 插件提供的安全 HTML 代码渲染服务。 核心用途是将代码文本安全地渲染为主题自适应、防转义的 HTML 代码块。适合需要在自定义 UI 中展示高质量代码排版的 Web 插件开发者。

包名
@ch4acko3/dsh-code-render
兼容性
待验证
Harness 依赖范围
>=0.1.0-rc.8
Cordis 依赖范围
^4.0.1
版本
0.1.2
许可证
MIT
最近更新
2026年8月28日

同名包的其他仓库

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:CH4ACKO3/dsh-render-engine#cca409bdfbcdb58e20267f970744d9b2918d218a&path:packages/code-render

@ch4acko3/dsh-code-render

A browser-side Cordis service that renders ctx.syntaxHighlighter tokens as safe, theme-aware HTML code blocks.

export const inject = ['codeRenderer']

export function apply(ctx) {
  const result = ctx.codeRenderer.render({
    code: 'const answer = 42',
    language: 'ts',
  })
  console.log(result.html)
}

Source text and HTML attributes are escaped. Colors follow DSH's --shiki-* CSS variables, and original LF, CRLF, or CR line endings are retained.