Development & Runtime

code-render

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

CH4ACKO3

Escaped, theme-aware HTML code-block rendering service for DSH Web plugins, built on structured syntax-highlight tokens with source line-ending preservation.

License
MIT
Added
2026-08-23
Maintenance
active
Install kind
github

No manifest check is available; listing does not imply compatibility or security review.

安装

dsh plugin --profile web add github:CH4ACKO3/dsh-render-engine#path:/packages/code-render

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

For install and environment setup, plus plugin development tutorials, see DSH community docs ↗

README

Source README · body: en · Read Chinese README

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.