Markdown formatter
Updated
A markdown formatter (md formatter) takes messy markdown and returns a consistently formatted version: uniform list markers, one emphasis style, aligned tables, and normalized spacing. It parses your document and re-prints it, so the rendered result never changes — only the source gets cleaner. Paste, format, copy.
Input
14 linesFormatted
Formatting is semantic: the document is parsed and re-printed, so the rendered result is identical — only the source style changes. Runs fully in your browser.
What does a markdown formatter normalize?
- List markers — a document mixing
-,*, and+bullets comes out using one marker of your choice, with consistent indentation for nested lists. - Emphasis style —
*asterisks*and_underscores_render identically, but mixing them in one file reads badly. Pick one; the formatter applies it everywhere, to bold too. - Tables — cells get padded so pipes line up vertically, the same formatting our table generator produces.
- Headings — setext headings (underlined with
===) become ATX headings (#), and stray spaces after the hashes are removed. - Spacing — extra blank lines collapse, and blocks are separated by exactly one blank line, which some renderers require.
How is this different from find-and-replace?
The formatter is built on remark, the same parser used by Prettier's markdown support and thousands of documentation pipelines. Your text is parsed into a syntax tree and printed back out — which is why it can safely tell the difference between a * that starts a list item and a * inside a sentence, or between an underscore in variable_name and one that starts emphasis. A regex-based beautifier can't make those distinctions; a parser can.
One consequence worth knowing: because the output is re-printed from the tree, insignificant quirks of your original source (trailing whitespace, inconsistent escape styles, indented vs. fenced code) are normalized to the standard form. If some exotic construct matters to your toolchain, diff the output before committing it.
When should you format markdown?
- Before committing docs — a formatted README diffs cleanly in code review because only real changes show up, not style noise.
- After AI generation — LLM-generated markdown often mixes emphasis markers and bullet styles mid-document; one pass here fixes it.
- Merging docs from multiple authors — unify everyone's habits into one house style.
- Cleaning up exports — Notion, Google Docs, and other exporters produce technically-valid but ugly markdown.
What is an md formatter?
An md formatter (markdown formatter or beautifier) is a tool that rewrites the plain-text source of a .md file into one consistent style — one bullet marker, one emphasis character, aligned table pipes, standard spacing — without changing what the document renders as. This one runs entirely in your browser and is free.
Will formatting change how my document renders?
No — that's the core guarantee. The document is parsed and re-printed, so the HTML any renderer produces from the output is the same as from the input. The only changes are to the plain-text source.
Does my text leave the browser?
No. Parsing and printing run entirely client-side. Nothing is uploaded, logged, or stored.
Can I enforce this style automatically in a repo?
Yes — add Prettier (which formats .md files out of the box) or remark-cli with remark-preset-lint-consistent to your CI. This tool is the zero-setup version of the same idea.
Why did my HTML comment or footnote survive untouched?
Inline HTML and GFM footnotes are preserved verbatim — the formatter only restyles constructs it fully understands.