Markdown Cleanup is a Visual Studio Code extension that formats Markdown documents in place. It trims extra whitespace, normalizes spacing, and preserves structured blocks such as code fences, lists, headers, tables, and block quotes.
What it does
The formatter processes the active Markdown document and:
trims outer whitespace
normalizes line endings
keeps fenced code blocks unchanged
preserves headers, bulleted lists, numbered lists, tables, and block quotes as separate sections
applies a simple cleanup pass to plain text sections
How to use it
Open a Markdown file in VS Code.
Open the Command Palette with Ctrl+Shift+P.
Run Markdown Cleanup.
The extension replaces the current document contents with the formatted result.
You can also use VS Code's built-in format action on Markdown files because the extension registers a Markdown document formatting provider.
Supported markdown sections
fenced code blocks
headers
bulleted lists
numbered lists
tables
block quotes
Features
Works on the currently active Markdown editor
Exposes a command named Markdown Cleanup
Registers a Markdown formatter for standard VS Code format actions
Keeps code blocks untouched while formatting surrounding text
Requirements
Visual Studio Code 1.125 or newer
A Markdown file open in the editor
Extension settings
This extension does not currently require any custom settings.
Known issues
The formatter is intentionally simple and may not preserve every complex Markdown layout exactly.
Very customized spacing may be normalized to a more standard structure.
Release notes
0.0.1
Initial release of the Markdown Cleanup extension.