Markdown Formatter

Markdown accepts three bullet characters, two heading styles and any table spacing you feel like typing. All of those render fine and none of them survive a diff review. Paste your document, pick the conventions you want, and get one consistent version back with a report on the structural problems the renderer will not warn you about.

Markdown formatting studio

Bullet
Numbers
Italic
Wrap
Hard breaks
nothing leaves this tab

Rendered preview

Press Ctrl + S to format without reaching for the mouse. The parser is JavaScript in this page, so your draft is never uploaded.

Document readout

  • 0Words
  • 1 minRead time
  • 0Headings
  • 0Links
  • 0Images
  • 0Code blocks
  • 0Tables
  • 0Longest line

    Heading outline and anchors

      Markdown renders anything. That is the problem.

      A Markdown file has no compiler shouting at you. Write a bullet with a star on one line, a dash on the next, indent a sublist by three spaces, and every renderer still produces something. The output looks fine. The file is a mess, and the mess only surfaces when a teammate reformats it in their editor and the pull request shows 240 changed lines for a two word fix. This page settles those choices in one pass so the next diff shows the edit instead of the whitespace.

      Pasted in
      Project Falcon
      ==============
      ##Install
      * npm i falcon-queue
      * npx falcon init
      1. Start the worker
      1. Point it at redis
      Formatted out
      # Project Falcon
      ## Install
      - npm i falcon-queue
      - npx falcon init
      1. Start the worker
      2. Point it at redis

      Formatting is half of what happens when you press Format. The panel above also reads the document structure and reports what it finds: how the heading levels step, whether two headings collide on the same anchor slug, which images ship without alt text, how many URLs are sitting in the text as bare strings. Those are the defects that survive a proofread because nothing about them looks wrong on screen.

      List indentation is where files quietly split in two

      The nesting rule in CommonMark is stricter than most people write. A child list has to be indented to the point where the parent item's content starts, not by some fixed number of spaces. Under a dash bullet the marker is two characters wide, so the child needs two spaces. Under 10. the marker is four characters wide, so the child needs four.

      Parent markerMarker widthChild indentThree spaces instead
      - item22 spacesStill nests, extra space is trimmed
      1. item33 spacesCorrect
      10. item44 spacesReads as an indented code block in strict parsers
      - item with 4 spaces22 spacesGitHub nests it, some parsers make a code block

      The formatter reads your original indent depth to work out which level each item belongs to, then rewrites every level from scratch using the width of its own parent marker. Hand written files usually come back one or two spaces narrower per level, which is the point. What you get is nesting no parser has to guess at.

      Two heading syntaxes, one of which turns into a horizontal rule

      Markdown supports setext headings, written by underlining a line with equals signs or dashes. They look tidy in a plain text editor and they carry a trap: a setext underline made of dashes is one blank line away from being a thematic break.

      Release notes
      -------------
      Release notes
      -------------

      The first pair is an H2. The second is a paragraph followed by a horizontal rule, because the blank line ended the paragraph before the dashes arrived. Delete a line by accident and your section heading becomes decoration. Everything here converts to ATX form, the hash prefix style, which has no positional dependency at all. Closing hashes are stripped, missing spaces after the hashes are added, and stray indentation before them is removed.

      Table pipes are the one alignment that changes meaning

      Whitespace inside a Markdown table is ignored by the renderer, with one exception. The colons in the delimiter row set column alignment, and they are easy to get wrong when the row is written by hand.

      Delimiter cellResultCommon mistake
      ---Renderer default, usually leftNone
      :---LeftWritten as :--: by accident
      ---:Right, the one numbers wantColon placed at the wrong end
      :---:CentreOnly one colon typed, so it silently goes left

      Alignment is read from the delimiter row, then every cell is padded so the source columns line up on screen. Escaped pipes and pipes inside backtick spans are left alone, since those belong to the cell content rather than the structure. Turn the checkbox off when a table has one wide prose column, because padding to that width makes the source worse rather than better.

      Hard breaks are two invisible spaces

      A line break inside a paragraph is written as two trailing spaces. Nothing shows them. Editors strip trailing whitespace on save, linters flag them as errors, and reviewers delete them without noticing, at which point an address block collapses into one run-on line. The other spelling is a trailing backslash, which is visible, survives every save hook, and is supported by CommonMark.

      The Hard breaks control decides which form your document uses. Keep spaces preserves what you wrote, Backslash rewrites every hard break in the visible form, and Drop removes them so paragraphs reflow. Any trailing whitespace that was not acting as a break is removed either way.

      What the report flags while it formats

      Where this page stops

      Run the formatter before you commit rather than while you write. Reformatting a file someone else is editing produces a conflict on every line, which costs more than the tidiness gains. On a shared repository, agree the bullet character and the wrap setting once, then keep everyone on it.

      Questions people ask about formatting Markdown

      What the formatter rewrites, what it refuses to touch, and how to read the report.

      Will formatting change how my document renders?

      The intent is that it does not. Bullet characters, ordered list numbering, heading syntax and table padding are all invisible to the renderer, so swapping them changes the source without changing the page. Two settings do alter output if you choose them. Dropping hard breaks removes line breaks inside paragraphs, and wrapping at 80 or 100 columns reflows paragraph text. Leave both on their defaults and the rendered result matches what you started with.

      Why did my ordered list get renumbered from 1, 1, 1 to 1, 2, 3?

      Both forms render identically, since Markdown counts items rather than reading your numbers. Writing every item as 1. means inserting an item in the middle needs no edits below it, which is why many style guides prefer it. Sequential numbers read better when someone opens the raw file. Switch the Numbers control to All 1. if your project follows the first convention.

      My code block lost its indentation. What happened?

      Fenced blocks are passed through character for character, so that is not the cause. Indented code blocks, the kind written with four leading spaces instead of a fence, are only recognised when a blank line sits above them and no list is open. Inside a list the same four spaces are list content, which is exactly the ambiguity that makes indented blocks fragile. Wrap the code in a fence with a language tag and the problem stops recurring.

      What does the duplicate anchor warning actually break?

      Every heading becomes a link target derived from its text. Two headings with the same text produce the same slug, so one of them has to be renamed by the renderer. GitHub adds a numeric suffix to the second, other tools use different rules or overwrite the first. Any link you wrote to that anchor now points at whichever heading won. Rename one of the headings and both targets stay stable.

      Does the outline match the table of contents my docs site builds?

      Close, not identical. The slug rule used here lowercases the text, strips punctuation and inline formatting, then joins words with hyphens, which is what GitHub and most static site generators do. Emoji, non Latin scripts and duplicate handling differ between platforms. Treat the outline as a structural check and a starting point for a manual table of contents rather than a guarantee about your build.

      Should I wrap lines at 80 columns?

      It depends on how the file is reviewed. Wrapped text produces readable diffs in a terminal, since editing a sentence touches one or two lines rather than a whole paragraph. Unwrapped text, one line per paragraph, works better with editors that soft wrap and with translation tooling. Pick one per repository. Mixing both is what produces the noisy diffs people blame on the formatter.

      Can it handle README files with HTML in them?

      Raw HTML blocks are left as written. Badge rows, alignment divs and details elements come through unchanged, since reformatting them risks breaking layout the Markdown parser never sees. The trade off is that Markdown inside an HTML block is not normalised either, so a list wrapped in a details element keeps whatever bullets it had.

      Is anything sent to a server?

      No. The parser, the report and the preview all run as JavaScript in this page. The only network requests are for the editor and preview libraries when the page loads, so once it is open you can disconnect and every button still works. Nothing is stored between visits and closing the tab clears what you pasted.

      Why is my read time different from the one my CMS shows?

      The figure here is words divided by 230 per minute, rounded up, with punctuation and Markdown syntax excluded from the count. Publishing platforms use anything from 180 to 265 words per minute and some add time for images and code blocks. Use the number to compare two drafts of the same document rather than to match another tool.