Noteline

← All posts

7 min read

How to clean up AI Markdown from ChatGPT and Claude

Clean up AI Markdown from ChatGPT and Claude: fix stray bullets, broken tables, and bad code fences in a live-preview editor, then export clean.

AI assistants write in Markdown, and the output is usually almost right. A heading lands one level too deep, a list has stray bullets, a table is missing its separator row. To clean up AI Markdown, paste it into a Markdown editor with live preview, fix the structure wherever the preview breaks, then save or export. This guide covers the common messes from ChatGPT and Claude and how to fix each one.

Why is AI output always Markdown?

Because Markdown is the format models read and write natively. ChatGPT, Claude, Gemini, and most other assistants format their answers in Markdown: # for headings, - or * for lists, **bold**, fenced code blocks, and pipe tables. The chat window renders that into clean text, so you usually don't see the raw symbols.

You see them the moment the text leaves the chat. Copy an answer, paste it somewhere else, and you get the raw source: literal ## in front of headings, asterisks around words, pipes and dashes where a table should be. That raw Markdown is what you have to work with, and most of it is fine. Only a few spots break.

The breaks are predictable. Once you know the handful of ways AI Markdown goes wrong, each one is usually a one- or two-line edit.

What are the common AI Markdown messes?

Most of the damage falls into five buckets. Here's what each one looks like and what it should be.

Problem What you see The fix
Stray or mixed bullets * and - markers in the same list, or a bullet on its own line Pick one marker; put a blank line before the list
Broken tables Missing separator row of dashes, uneven pipe counts Add the separator row; match the pipe count per row
Inconsistent headings Jumps from # to ###, or every line is ## Step heading levels by one; demote a too-big title
Code fence issues Unclosed fence, missing language, fence at the wrong indent Close every fence; add a language; match the list's indent
Extra escaping \#, \*, \_ showing as literal backslashes Remove backslashes where you don't want a literal symbol

Two of these deserve more detail, because they're the ones most likely to break an export.

Stray bullets and broken lists

The classic case is a list with no blank line above it, so the first item glues onto the previous paragraph. Another is a model mixing * and - markers, or nesting at the wrong indent so a sub-item renders flat. Sometimes you get a single orphan bullet, where the AI started a list and changed its mind.

One rule fixes most of it: a list needs a blank line before it and one consistent marker. For nesting, indent the child item so it lines up under the parent's text. With a - marker that means two spaces; with a multi-digit ordered marker like 10. the parent's text starts further over, so the child has to indent more to match. When the preview shows a clean nested list, you're done.

Broken tables

Pipe tables break when the separator row is missing or malformed. A valid table needs three parts: a header row, a separator row of dashes, then the data rows. AI sometimes drops the separator, or produces rows with a different number of pipes than the header. Most renderers then show the whole thing as plain text with visible pipes.

The fix is mechanical. Confirm there's a separator row of dashes directly under the header, and make every row carry the same number of columns. The preview tells you whether it parsed as a table or fell back to raw text.

Code fence problems

Fenced code blocks open and close with triple backticks. The two failure modes are an unclosed fence, where everything after it turns into code, and a fence indented to the wrong column inside a list, which a parser may not read as a fence at all. Inside a list item, the fence should sit at the same indent as the item's content. Adding a language hint after the opening fence (for example, python) also restores syntax highlighting that the AI sometimes omits.

How do I clean up AI Markdown fast?

The reliable way is to work in an editor that renders Markdown as you type, so you see structure breaking instead of guessing. Here's the routine:

  1. Paste the raw answer into a Markdown editor. Don't paste it into Word yet. Word doesn't read Markdown, so it would just show you the same raw symbols. (More on that mismatch in turning AI answers into Word and PDF.)
  2. Scan the preview for breaks. A table that didn't render, a list that ran flat, a code block that swallowed the next paragraph. These stand out against the rendered text.
  3. Fix headings first. Demote an over-large title, then make sure levels step down by one (# to ## to ###) without skipping. This sets the document outline.
  4. Repair tables and lists. Add missing separator rows, even out pipe counts, add the blank line before each list, settle on one bullet marker.
  5. Close every code fence and add a language hint where it helps.
  6. Fix the escaping. Remove a stray \#, \*, or \_ where you wanted the plain symbol, but keep the backslash where you actually want a literal * or # that shouldn't trigger formatting.
  7. Save or export. You now have clean Markdown you can keep as a file or convert to a document.

The preview is your test. If **bold** looks bold, the table has borders, and the code block is monospaced, the Markdown is valid. If something isn't rendering, you can see which line to fix and edit it in place.

Why clean it up before exporting?

Because an export is only as good as the Markdown going in. A Markdown-to-Word or Markdown-to-PDF converter maps ## to a real Heading 2, a pipe table to a native table, a fenced block to monospaced code. If the table is missing its separator row, the converter can't recognize it as a table, so it lands in your document as a line of pipes and dashes. Broken structure in means a broken document out.

One thing to know before you export: a Mermaid diagram is a fenced code block, not an image. A live-preview editor can render it as a diagram on screen, but Word and most PDF converters treat that fence as plain code, so the diagram itself won't survive the export. If you need the picture in the document, paste it in as an image.

Cleaning up first also future-proofs the text. The clean .md file is something you can reopen in any editor, search with grep, diff with Git, or feed back to an AI later. That's the larger case for keeping notes as plain Markdown files. The file outlives the tool.

Do it in Noteline (paste, tidy, export)

Noteline is a Markdown editor where every note is a plain .md file, with Typora-style live preview and offline Word and PDF export in the desktop app.

  • Paste the AI answer into a new note. Noteline reads the Markdown and renders it (headings, bold, tables, code blocks, and Mermaid diagrams), so broken structure stands out from the rendered text.
  • Tidy where the preview breaks. Fix the heading level, add the missing separator row, close the fence. It's a normal text editor, so you're editing text and watching the preview confirm each fix.
  • Export to Word or PDF from the desktop app. The converters are bundled and run fully offline, so nothing is uploaded. You get a clean .docx or .pdf from an answer that started as raw chat output.

Because notes are plain files, the cleaned Markdown stays yours and syncs through iCloud, Dropbox, OneDrive, or Git like any other file. You can tidy Markdown in the free web editor in your browser without installing anything, and use the desktop app when you need offline Word and PDF export.

The short version

AI gives you Markdown that's almost clean, and the ways it breaks are limited: bullets, tables, heading levels, code fences, and escaping. A live-preview editor turns each one into a quick, visible edit. Tidy the text once, keep the .md file you own, and export when you need a document. Clean Markdown means a clean Word file, a clean PDF, and a file you can reopen anywhere.