Markdown Formatter

Paste a Markdown document and the formatter rewrites it to a consistent style: fixes heading level jumps (no H2 after H4), pads table columns to align in the source, enforces a single blank line between blocks, normalises list markers to -, collapses runs of blank lines, and sorts reference-style link definitions at the bottom. The rendered HTML doesn’t change, only the source file gets tidier, so diffs become readable.

How the formatter rewrites Markdown

  1. 1

    Paste Markdown

    Drop the raw document: README, docs page, meeting notes.

  2. 2

    Pick style options

    List marker (`-`/`*`), heading style (ATX/Setext), table alignment, wrap column.

  3. 3

    Format

    The tool parses the document into an AST and re-serializes it with the chosen style.

  4. 4

    Diff the output

    A side-by-side view shows what changed before you paste it back.

What the formatter fixes

  • List markers. *, -, + all get normalised to one consistent character (default -).
  • Heading hierarchy. Warns (or promotes) when H2 is followed by H4 with no H3 in between.
  • Blank lines. Exactly one blank line between blocks; no runs of three or more.
  • Tables. Pads each column so the pipes align in the source, even though Markdown renderers don’t care.
  • Trailing whitespace. Strips trailing spaces on every line except the intentional two-space line-break marker.
  • Reference links. Collects [label]: url definitions at the end of the document, sorted alphabetically.
  • Code fences. Language tag is normalised to lowercase; indent-based code blocks become fenced blocks.

Style options you can set

Option Default Alternatives
List marker - *, +
Heading style ATX Setext for H1/H2
Emphasis delimiter * _
Bold delimiter ** __
Wrap column 0 (off) 80, 100, 120
Sort reference links on off

Why consistent Markdown matters

In a team repo, inconsistent Markdown produces noisy diffs: every time someone saves a file with a different editor, list markers swap and tables reflow. A formatter enforces one style so pull request reviewers see only content changes. Think of it as prettier for prose.

When not to format

  • Fenced code blocks stay byte-for-byte intact, the formatter will never touch the contents of a code block. If formatting changes code, it’s a bug.
  • Intentional hard wraps at narrow widths (readme.md on a terminal project) get re-wrapped if you enable the wrap column. Disable wrap if you keep hand-tuned line breaks.
  • Embedded HTML blocks pass through unchanged.

Drop-in replacements

If you prefer a local CLI, the formatter uses the same AST rules as remark-stringify with the remark-gfm plugin. prettier --parser markdown produces a similar result.

Frequently Asked Questions

No. The formatter rewrites the source only, rendered HTML output for both the before and after should be equivalent. If you see a rendering change, report it as a bug.

No. YAML or TOML front-matter at the top of the file is detected and passed through untouched.

Yes, set the wrap column to 80, 100 or 120 and paragraphs will be rewrapped. Lines inside code fences are never touched.

No. The formatter assumes your links work; it only reorganizes reference-link definitions. Use a link checker tool separately.

No. Parsing and formatting run in your browser; the content never leaves your device.

Related Tools

Tool available in other languages