Development & Runtime
code-render
CH4ACKO3/dsh-render-engine/packages/code-render · ★ 1
Escaped, theme-aware HTML code-block rendering service for DSH Web plugins, built on structured syntax-highlight tokens with source line-ending preservation.
安装
dsh plugin --profile web add github:CH4ACKO3/dsh-render-engine#path:/packages/code-renderGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
For install and environment setup, plus plugin development tutorials, see DSH community docs ↗
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.