markdown-to-rich-text

Turn Markdown into formatted text that pastes properly into Outlook and Word.

The copy button in a Claude chat (Claude Code, claude.ai) copies the reply as Markdown, so pasting it into an email gives you literal ## headings and **asterisks**. Selecting the rendered chat and copying that instead drops the heading levels and brings the chat's theme along. This page puts an HTML version on the clipboard, which Outlook and Word turn into real formatting.

Use

Open markdown-to-rich-text.html in a browser, either from disk or from wherever the tools are hosted.

  1. Copy the reply in Claude.
  2. Click into the page and press Ctrl+V.
  3. Paste into Outlook or Word.

With Pasting replaces the text and copies the result straight away ticked (the default), step 2 does the whole job: the paste replaces whatever was in the box, and the formatted version goes straight onto the clipboard. Untick it to edit the Markdown first, with paste behaving normally, then press Copy formatted text. The checkbox setting is remembered in the browser.

If headings arrive in Outlook as plain bold text, Outlook is pasting with Merge formatting, which keeps bold and lists but drops headings and paragraph spacing. Pick Keep source formatting from the paste options after pasting, or make it the default under File → Options → Mail → Editor Options → Advanced → Pasting from other programs.

The clipboard gets two versions: HTML, which Outlook and Word use, and the original Markdown as plain text, for places that only take plain text.

What the output looks like

The preview shows exactly the HTML that gets copied. Markdown is parsed with marked (GitHub-flavoured), loaded from jsdelivr. A single line break is kept as a line break, as Claude and GitHub comments render it, instead of being joined into the paragraph as strict Markdown would. Tick Join single line breaks into one paragraph (off by default, remembered in the browser) for the strict behaviour, when pasting raw .md written with one sentence per line. Blank lines still separate paragraphs, and a hard break (two trailing spaces) still breaks the line.

Tests

Playwright drives Chromium, copies, and reads back what's on the clipboard. They need network access to reach the CDN.

uv run --with playwright playwright install chromium  # once, to get the browser
uv run tests/test_markdown_to_rich_text.py

Contents

📁tests/
📄markdown-to-rich-text.html8.4 KB
📄README.md3.8 KB