Skip to main content
  1. Posts/

Tool: Preserve Markdown Formatting from AI with Paste to Markdown

·316 words·2 mins

Copy a table out of ChatGPT or Gemini and the formatting shatters wherever you paste it. A small utility reads the clipboard and converts it to clean Markdown — tables, code blocks, Mermaid diagrams, and LaTeX all intact.

Why the Table Always Breaks #

You ask ChatGPT or Gemini for a nicely formatted table, it produces exactly what you wanted, you select and copy — and the formatting falls apart the moment you paste it into an editor.

The reason is that copying from a web page does not put only text on the clipboard. It puts two versions there: a plain-text one and an HTML one carrying that page’s own formatting tags. Which version an editor takes is up to the editor. Take the plain text and your table becomes a pile of loose lines; take the HTML and you drag in a heap of unrelated tags and styles. Either way you rebuild it by hand.

That gets old fast. So I wrote a small utility for it.

Run it here: https://tools.vinhmdev.com/clipboard2markdown

The tool reads the HTML version off the clipboard — from any source, a web page, Word, Excel, or an AI response — and converts it into clean Markdown. The interface splits in two: editor on the left, preview on the right, updating as you type.

What Is Built In #

Behind the gear icon ⚙️ are a few options worth turning on:

  • Auto-convert to Markdown on paste. Instead of dumping the source formatting in, Ctrl+V converts the content into clean Markdown by itself.
  • Mermaid and LaTeX preserved. This part is for engineers: Mermaid diagram syntax and LaTeX math pass through intact, with nothing truncated or wrongly escaped — which is exactly what most other converters get wrong.
  • Synced scrolling. Editor and preview scroll together, for long documents.
  • Multi-format export. One click to produce .md, .docx, or .pdf.

The Paste to Markdown tool with its settings panel
https://tools.vinhmdev.com/clipboard2markdown

Three Steps #

  1. Copy: select the output you want from ChatGPT or Gemini.
  2. Paste: open the tool and paste it in.
  3. Export: hit the orange Copy Markdown button. Clean Markdown is on your clipboard, ready to drop straight into GitHub or a Hugo blog.