md-preview

Reviewed at commit 9c2b0e2 New version, not yet reviewed

Sends data to GitHub (api.github.com), through your signed-in gh CLI, only for Markdown files git does not ignore in a repo with a GitHub remote; can be switched off

Renders the Markdown files Claude edits like GitHub does in a pane, with before and after side by side.

Made by
Hamza Zafar
What we checked

Shows the Markdown files Claude edits, rendered like GitHub, in a pane, with the before and after side by side. When the file is in a GitHub repo, not git-ignored, and gh is signed in, the Markdown text goes to GitHub's render API (an option turns this off); otherwise a built-in renderer runs on your machine. It runs headless Chrome to draw pages and keeps temp files.

Review details

Static review of the source at the pinned commit; not run. Delta review of the changes since 3719682; the rest carries over from the review at that commit. Registers session.start, turn.start, turn.complete, tool.call (observes Write, Edit and MultiEdit on .md, .mdx and .markdown files; before any shell command it snapshots up to 200 Markdown files of the repo in memory to catch writes that skip Write/Edit), command.run (/md, /mdview) and ui.render (Pane). Runs git ls-files, git remote -v, gh api -X POST /markdown (sends the file text and the owner/repo name as context to api.github.com; skipped above about 390 KB, outside a GitHub repo, or when gh fails), a local sh script that starts Chrome or Chromium headless with its own throwaway profile to draw PNGs, and open or xdg-open on its own generated HTML page. The page has a restrictive Content-Security-Policy and the built-in renderer strips script-like tags and handlers. Remote images in the Markdown can still be fetched by Chrome (img-src *). Never blocks or changes a tool call; failures are swallowed. Changes in this version: a new githubRenderer user option (default on) can disable sending text to GitHub; files git ignores (git check-ignore) are never sent and render locally; the temp folder is now created with mktemp -d (private to the user, one per load) instead of a fixed $TMPDIR/md-preview; the browser opener is chosen with uname -s instead of testing /usr/bin/open; the git ls-files snapshot has a 5 s limit and stays off for the turn if it fails; compare accepts quoted paths; the built-in HTML sanitizer was rewritten (repeated passes, attribute scrubbing, entity-decoded URL checks, fail-closed escape) and some regexes were made linear-time. All changes tighten privacy or safety; no new hosts, files or permissions.

What it uses
  • Reads your prompts: no
  • Sees tool calls: yes
  • Blocks or changes tool calls: no
  • Reads or writes files: yes
  • Runs programs on your machine: yes
  • Calls the model (uses tokens): no
  • Sends data over the network: yes
  • Stores data: no
  • Shows something on screen: yes
Hooked events
Screenshot of md-preview

Shows the Markdown files Claude edits, rendered like GitHub, in a pane next to the chat. Before and after side by side. /md opens it.

Made this mod? Add a badge to your README

modsforClaude badge for md-preview

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/md-preview.svg)](https://modsforclaude.com/mods/md-preview/)

← All mods