Formatter

Markdown
formatter

Formats and beautifies your Markdown with consistent styling. Fixes heading spacing, trailing whitespace, and list indentation while leaving your content untouched.

Want your formatted markdown auto-committed to a repo?

md0 CMS keeps your GitHub-hosted content clean automatically, so every save is already consistent.

See the CMS

What this formatter does

Formatting rules

  • Normalizes heading spacing (blank line before and after)
  • Removes trailing whitespace
  • Converts * and _ to a consistent style
  • Standardizes list indentation

What stays the same

  • Content, headings, link URLs, and code blocks
  • Only whitespace and consistency issues change

When to use it

  • After pasting markdown from multiple sources
  • Before committing markdown to a repository
  • To enforce consistent style across a team's documents

When you actually need this

Mixed-source docs

You pull together a README from Notion exports, GitHub wiki pages, and a few Word-to-markdown conversions. Each source has different spacing habits around headings and inconsistent use of * versus _ for bold text. Running everything through the formatter once produces a unified file, and you skip hunting down every inconsistency by hand.

Pre-commit cleanup

Your team's markdown linter in CI keeps failing on trailing whitespace and missing blank lines before headings. Paste the offending file here, grab the formatted output, and commit something that passes, skipping the ten minutes of whitespace edits in your editor.

Documentation audits

You review a docs site with 40 markdown files written by different contributors over two years, and the style varies file to file. Format each file before editing it, and your changes stay out of diffs cluttered with unrelated whitespace noise.

How the formatter works

Deterministic rules

The formatter reads your markdown line by line and applies a fixed set of rules. No AI and no guessing. The same input always produces the same output.

Heading spacing

The formatter inserts blank lines before and after heading lines when they're missing. The CommonMark spec requires this spacing, and without it, some parsers misread headings as paragraph text.

Whitespace and indentation

The formatter strips trailing spaces and tabs at the end of each line, invisible in most editors but capable of breaking rendering in some markdown processors. It also standardizes nested list indentation to two spaces, since mixed tabs and spaces are a common cause of broken lists.

What stays untouched

Code blocks, whether fenced or indented, stay completely alone, along with your heading text, link URLs, image alt text, table cell values, and any embedded HTML blocks. The formatter also skips line-length limits, so it never wraps or breaks long lines.

Frequently asked questions

Will the formatter change my content?

No. The formatter adjusts whitespace and punctuation consistency only. It never touches heading text, paragraph content, link URLs, image paths, or code block contents. Paste in a 500-word document, and you get back a 500-word document with the same words in the same order.

Why do heading spacing rules matter?

Several markdown parsers and static site generators require a blank line before a heading to render it correctly. If a heading immediately follows a paragraph with no blank line, some parsers treat it as a continuation of that paragraph rather than a new section. The formatter adds those blank lines automatically, catching a rendering bug that's hard to spot by eye.

Is my markdown stored or logged?

No. Formatting runs entirely in your browser, and your text never reaches a server. Check the network tab in your browser's developer tools while you format something to verify it yourself.

Can I use this for very large files?

Yes, within reason. The formatter handles files up to several hundred kilobytes without trouble, and files with thousands of lines still format in under a second on a modern browser. For anything larger than a few megabytes, a local tool like prettier --parser markdown or markdownlint --fix runs faster from your terminal.