Markdown Formatter
Run Prettier over Markdown, with the parser already selected.
Mostly useful for making tables line up and for normalising documents that several people have edited with different conventions.
What gets normalised
- List markers become consistent, rather than a mix of -, * and +.
- Table columns are padded so the pipes align in the source.
- Ordered lists are renumbered.
- Heading style is made consistent.
- Emphasis markers are unified.
Prose wrapping is left alone by default
Prettier preserves your line breaks in prose rather than reflowing paragraphs, because rewrapping produces enormous diffs when one word changes. If your project prefers one sentence per line, that convention survives formatting.
Code blocks inside Markdown
Fenced blocks with a language tag are formatted with that language parser, so a JavaScript sample inside your README is tidied along with the prose. A block with no language tag is left exactly as written.
That behaviour is occasionally unwanted - a deliberately misformatted example demonstrating a lint rule will be quietly corrected. Removing the language tag, or adding an ignore comment, protects it.
Front matter is left alone
YAML front matter at the top of a Markdown file is recognised and passed through rather than reformatted as prose, which keeps static site generators working.
Its contents are formatted as YAML where the parser can do so safely, so a static site post comes out consistent in both halves of the file.
Tables and alignment markers
Column widths are padded so pipes line up in the source, and alignment colons in the separator row are preserved. The rendered output is unchanged either way, but a source-aligned table is far easier to edit by hand.
Very wide tables are left unpadded, since padding them would push lines past any sensible width for no readability gain.