dsh-markdown-render
Đã xác minh@ch4acko3/dsh-markdown-render · v0.1.2 · MIT · Giao diện web
Safe GFM rendering service with highlighted code blocks for DeepSeek Harness Web plugins
Cài đặt
dsh plugin add @ch4acko3/dsh-markdown-render Xác nhận layer đã áp bằng dsh --profile default --dump-config — xem hướng dẫn cài plugin.
Mã nguồn
Phát hành lên npm mà không có repository công khai. Hãy kiểm tra nội dung package trước khi cài.
Thẻ
Readme
@ch4acko3/dsh-markdown-render
A browser-side Cordis service that renders untrusted GitHub Flavored Markdown as sanitized, theme-aware HTML. Fenced code blocks reuse ctx.codeRenderer, so every downstream plugin gets the same language aliases, Shiki tokens, escaping, and DSH theme colors as the rest of the render engine.
export const inject = ['markdownRenderer']
export async function apply(ctx) {
const result = await ctx.markdownRenderer.render({
markdown: '# Result\n\n```ts\nconst answer = 42\n```',
mode: 'render-friendly',
})
console.log(result.html)
}
mode is optional. The default, gfm, preserves GitHub Flavored Markdown behavior, including ~text~ strikethrough. Use render-friendly when Markdown contains approximate values or prose that uses single tildes: it leaves ~text~ literal while continuing to render ~~text~~ as strikethrough.
The renderer supports GFM tables, task lists, strikethrough, links, images, blockquotes, and fenced code. Raw HTML is displayed as text, unsafe URLs and executable markup are removed, and the returned HTML contains only fixed renderer styles plus sanitized Markdown output.
The only required rendering dependency is ctx.codeRenderer. At render time, a mermaid fence checks ctx.get('mermaidRenderer'); $…$, $$…$$, and math/latex/tex/katex fences check ctx.get('mathRenderer'). Active optional services receive the source and replace the fallback with safe SVG or MathML. Without them, Markdown remains readable as highlighted code or literal source. This package depends on neither Mermaid nor KaTeX, so either renderer can be installed or removed independently.
This package provides no ChatView, file browser, editor, or export workflow. Those belong in downstream plugins.