Skip to main content

MD Collaborative Editor

A local markdown editor that renders exactly like GitHub, with Claude built in. You can highlight any passage and ask Claude to rewrite, tighten, restyle or critique it, then accept the suggestion or keep the original.

Install

PyPI

Install it from PyPI as a command with uv:

uv tool install md-collab-editor

Or run it once without installing:

uvx --from md-collab-editor md-editor

pipx install md-collab-editor works too. Upgrade later with uv tool upgrade md-collab-editor. For the latest unreleased code, install from GitHub instead: uv tool install git+https://github.com/garethnisbet/MDCollaborativeEditor.

Run

md-editor                       # edit the .md files in the current folder
md-editor ~/notes               # edit any folder
md-editor ~/proj/README.md      # edit one file (its folder becomes the root)
md-editor --port 9000 --no-browser

It needs only Python 3.9+ (standard library, no dependencies) and the claude CLI on your PATH; uv can't install claude, because it isn't a Python package. Without it, everything except Ask Claude still works. The page loads its libraries from a CDN, so the browser needs internet access.

To work on the editor itself, clone the repo and run uv run md-editor docs, which uses the code in the checkout.

Working with Claude

  1. Highlight text in the editor or in the rendered preview. In the preview a pop-up opens straight away; in the editor click the small ✦ Ask Claude pill or press Ctrl+J.
  2. Choose a preset (My style, Improve, Tighten, Expand, Simplify, Fix grammar, More formal/casual, To bullets/prose, Critique) or type your own instruction. An instruction ending in ? is treated as a question: Claude replies with a comment and leaves the text alone.
  3. A card appears in the Claude panel, and the passage is highlighted in purple while Claude works and in amber when the suggestion is ready. Each card offers:
    • Changes / Preview / Edit: a word-level diff, the rendered result, or a text box for tweaking it by hand;
    • Accept: replace the passage (Ctrl+Z undoes it);
    • Keep original: discard the suggestion;
    • Retry: ask for a different version;
    • Refine…: give feedback such as "shorter" or "keep the first sentence" and get a revised version.
  4. With nothing selected, the request applies to the whole document.

You can run several requests at once, and you can keep editing while Claude works, because each card tracks its passage as the text moves. My style uses the nisbet-writing-style skill; any skill in ~/.claude/skills appears as a preset. The model menu in the top bar picks Opus, Sonnet or Haiku.

Requests run through claude -p (headless Claude Code), so they use your existing Claude login and no API key is needed.

Working with Claude Code in a terminal

Documents are plain .md files on disk. When Claude Code, or anything else, edits a file, the open editor updates within about a second and briefly flashes the changed text. If you had unsaved edits at that moment, a banner asks which version to keep. The editor autosaves shortly after you stop typing (Ctrl+S saves at once).

Rendering

Rendering covers GitHub-flavoured markdown: tables, task lists (click the boxes in the preview to tick them), strikethrough, autolinks, > [!NOTE]-style alerts, syntax-highlighted code, $…$ and $$…$$ maths (KaTeX), ```math blocks, ```mermaid diagrams, heading anchors and inline HTML (sanitised). The preview uses github-markdown-css in light or dark (◐ button).

Editing

The toolbar covers headings, bold, italic, strikethrough, quotes, code, links, images, lists, task lists, tables and rules. Shortcuts: Ctrl+B/I/K, Ctrl+F to search, Tab to indent, and Enter to continue lists. Scrolling in the editor and the preview stays in sync, and clicking a preview block moves the cursor to it. Misspelt words get a wavy red underline as you type (British English; code, URLs and HTML are skipped). Right-click one for suggestions, to add it to your dictionary (kept in the browser) or to ignore it, and click abc✓ in the toolbar to turn checking off or on.

Opening files elsewhere

Click 📂 in the top bar (or Open… in the file list, or press Ctrl+O) to browse the disk. Click folders to move through them (↑ goes to the parent, ⌂ goes home), or type or paste a path and press Enter. Clicking a .md file opens it and makes its folder the working folder, so the sidebar lists its neighbours and live sync keeps working. Use this folder switches to the current folder without picking a file. The arrow keys and Enter also work in the list.

Exporting to PDF

Click ⬇ PDF in the top bar. The document is rendered in GitHub's light style (even in dark mode) on A4 pages, with maths and diagrams included and without Claude's highlights. It is saved as <name>.pdf beside the markdown file and downloaded by the browser. Relative image links resolve because the page is printed from the markdown file's folder. This uses headless Google Chrome or Chromium; set MDEDIT_CHROME=/path/to/chrome if it isn't found on the PATH. For the browser's own print dialog, press Ctrl+P; the print stylesheet prints only the rendered document.

Files

All code lives in src/md_collab_editor/:

  • server.py: HTTP server (file API, folder browsing and root switching, change events, /api/ask → claude -p, /api/pdf → headless Chrome)
  • static/index.html, static/app.css: layout and GitHub-style theme
  • static/render.js: markdown → HTML, with source offsets on every block so preview selections map back to the source
  • static/app.js: editor, sync, selection mapping, ask bar, suggestion cards and word diff

Metadata

Release files for md-collab-editor 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md-collab-editor 0.1.4
File Size Uploaded
md_collab_editor-0.1.4.tar.gz 36.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for md-collab-editor 0.1.4
File Interpreter ABI Platform
md_collab_editor-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 75.3 kB

Release files / md_collab_editor-0.1.4.tar.gz

Download URL md_collab_editor-0.1.4.tar.gz
Size 36.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e2dd02c0f3dd9667c8b74d3fe63027c5088decb9a57691c6114a9f20550da581
BLAKE2b-256 checksum
How to use checksums
4135785690b5412217d98aae3dc25f0f2b6e8f89af13c788ac806b777ebda921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / md_collab_editor-0.1.4-py3-none-any.whl

Download URL md_collab_editor-0.1.4-py3-none-any.whl
Size 38.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
309a31f697327924a492452a840e316ddc4ddd565579e6b2a5e12d8597258b69
BLAKE2b-256 checksum
How to use checksums
5ebce5855d0ff5f0b269148aa7b6529b9db74e01058bf28ecc1b5d366cf75174
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page