By · Updated

Markdown Formatter

Tidy Headings, Bullets, Aligned Tables and Renumbered Lists Without Touching Code

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Markdown Formatter works

This Markdown formatter tidies a document without changing what it says. Headings become ATX style, bullets share one marker, ordered lists are renumbered and tables get aligned columns. Blank lines and trailing spaces are cleaned up, and fenced code blocks pass through untouched.

Markdown is forgiving. The same heading can be written with hashes or an underline, a bullet can start with a hyphen, an asterisk or a plus sign, and a list numbered 1, 1, 1 renders the same as 1, 2, 3. That freedom is pleasant while writing and messy when several people edit the same README or docs site, because every edit produces a noisy diff and the source becomes hard to read.

What the Markdown formatter changes

The tool walks the document line by line and applies a small set of rules taken from common style guides such as markdownlint's defaults:

Lines Changed counts how many lines differ from the input, which is a quick way to judge whether a pull request will be mostly formatting noise.

What it deliberately leaves alone

Anything inside a fenced code block, opened with three or more backticks or tildes, is copied exactly, including indentation and trailing spaces. Inline code, links, emphasis and HTML are not rewritten. The formatter does not wrap or unwrap long paragraphs either, because reflowing prose changes every line in a diff and breaks the one-sentence-per-line style some teams use.

Two trailing spaces at the end of a line are a hard line break in CommonMark, so the tool keeps exactly two when they sit before another line of text. Everywhere else trailing whitespace is removed.

Sequential or all the same number

Both styles render identically, because Markdown only uses the first number of a list as its start value. Sequential numbering reads better in the raw file. Numbering every item 1. means inserting or reordering items never forces you to renumber the rest, which keeps diffs small. Pick one style per project and stick to it.

A list that starts at a number other than 1 keeps its start. The formatter only adds a blank line before an ordered list that starts at 1, because CommonMark lets only such a list interrupt a paragraph; adding one before 3. would turn a sentence into a list.

Choosing a bullet marker

The hyphen is the most common choice and the default in Prettier and most linters. The asterisk is also widespread but is easy to confuse with emphasis when a bullet starts with bold text. The plus sign is valid but rare. Whichever you choose, consistency matters more than the character: mixing markers in one list can split it into several lists in some renderers.

Why align tables

Aligned pipe tables are much easier to read and edit in a plain text editor, and reviewers can see a changed cell at a glance. The cost is that editing one wide cell can shift a whole column, which widens diffs. If your team edits tables often, Leave as is keeps the original spacing and only strips trailing whitespace.

Before you commit

Run the formatted text through your usual preview once. Markdown flavours differ at the edges: GitHub, GitLab, Pandoc and static site generators each add extensions such as task lists, footnotes and definition lists. The formatter only touches constructs common to all of them, but a quick look catches the rare document that relied on unusual spacing to render the way it did.

FAQ

Will the formatter change my code blocks?

No. Fenced code blocks are copied byte for byte, including indentation and trailing spaces. Inline code inside backticks is also left alone, so examples and snippets keep working exactly as you wrote them.

Does it wrap long lines?

No. Paragraph text keeps its original line breaks. Reflowing prose rewrites every line it touches and makes diffs hard to review, so the formatter only changes headings, lists, tables, rules and whitespace.

Why did a blank line appear before my list?

In CommonMark a list that directly follows a paragraph line can be read as part of that paragraph. A blank line is added before a top-level list so it always renders as a list, matching what most linters recommend.

Is my document uploaded anywhere?

No. Formatting runs in your browser with JavaScript. The text never leaves your device, which makes the tool safe for internal documentation, drafts and private notes.

See also: all Formatters & Validators tools, Dev Utilities, Data & Encoding, Security & Identifiers, SEO, Accessibility, AI.

Related tools