ruslanfialkovskii/md-render
md-render
Claude Code mod,將 Claude 的終端機回覆渲染成豐富的 Markdown,支援著色標題、醒目標示程式碼、提示框、網格表格、數學公式、mermaid 圖表與圖片。
關於這個 mod
md-render 是一個 Claude Code mod,會替換終端機回覆的繪製方式,但不會變更儲存的回覆。它加入著色標題、高亮程式碼區塊、行內程式碼與 kbd 樣式、工作清單、提示框(GitHub alerts 與 Obsidian callouts)、支援對齊與 CJK 寬度處理的框線網格表格、可點選連結、註腳與 wiki 連結、Unicode 與二維數學公式、透過 mermaid-ascii 顯示的 mermaid 圖表,以及終端機支援 kitty graphics 時的圖片。色彩遵循 Claude Code 主題鍵。選項在 /config 的 md-render 底下設定。安全注意事項:遠端圖片下載預設關閉,並限制為 https、上限 20 MB,因為提示注入的 URL 可能洩漏資料。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add ruslanfialkovskii/md-render claude plugin install md-render
原文 / README
md-render
A Claude Code mod that draws Claude's replies in the terminal as rich markdown, after render-markdown.nvim: tinted headings, highlighted code, callouts, grid tables, math, mermaid diagrams and images.
md-render replaces only how a reply is drawn. The stored reply and what Claude reads stay as they were, ctrl+o still shows the raw text, and the desktop app and IDE extensions keep their own renderer.
╭─────────────┬──────────┬────────┬──────────╮
│ Service │ Replicas │ p99 │ Status │
├━────────────┼─────────━┼───────━┼━────────━┤
│ api-gateway │ 3 │ 182 ms │ ok │
│ auth │ 2 │ 340 ms │ degraded │
╰─────────────┴──────────┴────────┴──────────╯
n
P(fail) = 1 - ∏ (1 - pᵢ)
i=1
Requirements
- Claude Code 2.1.287 or later, in a terminal. Mods are an early-access feature: their API may change between releases, and Anthropic can turn installed mods off remotely, in which case Claude Code's own renderer draws replies.
- A Nerd Font for the default icons, or set
iconstounicode. - Optional: mermaid-ascii
for mermaid diagrams; macOS
sipsand a terminal with kitty graphics (Ghostty, kitty) for images.
Install
In a Claude Code session:
/plugin install md-render --marketplace ruslanfialkovskii/md-render
Or from your shell:
claude plugin marketplace add ruslanfialkovskii/md-render
claude plugin install md-render@md-render
/plugin then shows 1 mod active · md-render under its tabs. Update with
claude plugin update md-render@md-render.
What it draws
| Element | Drawing |
| --- | --- |
| Headings | Level icon, colour and tinted bar (full width or behind the title), optional half-block border lines |
| Code blocks | Tinted block with the language's icon and name and Claude Code's syntax colours; or boxed, or plain |
| Inline code, ==highlight==, <kbd> | Background tints and inverse keys |
| Lists and task lists | Bullets by depth; checkbox icons for [ ], [x] and the custom [-] state |
| Quotes | A bar whose colour follows the nesting depth |
| Callouts | GitHub alerts and Obsidian callouts (26 types), with custom titles |
| Tables | Bordered grid (square, round, double, heavy), alignment markers, cells wrapped to fit, CJK widths |
| Links | Icon by site; https links are clickable (OSC 8), other URLs are shown after the label |
| Footnotes, wiki links | Superscript numbers and a notes section; [[page\|label]] |
| Math | $…$ as Unicode on one line; $$…$$ laid out in two dimensions (fractions, limits, matrices) |
| Mermaid | Flowcharts, sequence and ER diagrams drawn by mermaid-ascii, strokes in the accent colour |
| Images | An image alone in its paragraph is drawn as a picture where the terminal supports kitty graphics |
| HTML | Comments hidden; common inline tags styled; other tags left as written |
Colours are Claude Code theme keys, so md-render follows your theme: light, dark, daltonized and ANSI.
Options
Set them in /config under md-render; a change reloads the mod.
| Option | Values (default first) |
| --- | --- |
| enabled | true, false |
| icons | nerd, unicode |
| headings | full, block, plain |
| headingBorders | false, true |
| codeBlocks | full, block, box, plain |
| codeBorders | false, true |
| tables | full, normal, compact |
| tableBorders | square, round, double, heavy |
| links | clickable, url |
| math | unicode, raw |
| images | local, remote, off |
| mermaid | ascii, code |
| mermaidCommand | mermaid-ascii, or a full path to the binary |
| indent | false, true |
Images and safety
local draws image files on this machine only. remote also downloads https
images that a reply names. Downloading a URL a reply wrote is how a prompt
injection leaks data (the data rides in the URL), so leave remote off unless
you trust what the replies may contain. Downloads are https only, redirects
included, and capped at 20 MB.
Pictures are measured and, when not PNG, converted with macOS sips; converted
files go to $TMPDIR/md-render/. Without sips, or in a terminal without
kitty graphics, the image's alt text is shown instead.
What md-render runs
To see what md-render does before you install it, clone the repository and run
claude plugin validate .claude-plugin/plugin.json in it:
❯ ./register.tsx hooks: ui.render{component=AssistantMessage, surface=terminal}
❯ ./register.tsx calls: $.env.get (via readDiagram, readPicture), $.process.run (via readDiagram, readPicture), $.ui.resolve
❯ ./register.tsx env reads: HOME, TMPDIR
It runs mermaid-ascii on mermaid blocks; pwd, mkdir and sips for
images, so sips reads the image files a reply names; and curl only with
images set to remote. It reads no other files and makes no other network
requests.
Turn it off
Set enabled to false in /config, or disable or uninstall the plugin from
the Installed tab of /plugin.
Development
claude plugin validate --strict . # the marketplace
claude plugin validate --strict .claude-plugin/plugin.json # the plugin and its hooks module
claude plugin test .
| Path | Holds |
| --- | --- |
| hooks/register.tsx | The hooks module: the render hook, and the image and diagram loaders ($ stays in this file) |
| hooks/parse.ts | Markdown to blocks and inline nodes, with marked and extensions |
| hooks/inline.ts | Inline content as styled runs, and word wrapping |
| hooks/render.tsx | Blocks to Claude Code's elements |
| hooks/table.ts, latex.ts, mermaid.ts, images.ts | Grid tables, TeX to Unicode, diagram runs, image paths and sizes |
| hooks/style.ts, languages.ts | Options, colours and icons |
| tests/ | Tests for claude plugin test |
| dev/harness/ | Renders fixtures in a real session and captures the screen (README) |
claude plugin test runs only while Claude Code's remote switch for mods is on.
With CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, as in CI, the CLI skips the
remote check and the switch keeps its default.
To try a change without installing it, start Claude Code with
claude --plugin-dir . in this folder; saving a file reloads the mod.
Credits
marked parses the markdown (MIT, vendored
in hooks/vendor). Icons follow
render-markdown.nvim's
defaults, and language icons and colours come from
nvim-web-devicons (both MIT).
License
其他同名作品
- md-renderdeepskyblue86 · ★ 4
