Markdown/CommonMark linting and style checking for Visual Studio Code
The Markdown markup language is designed to be easy to read, write, and understand. It succeeds - and its flexibility is both a benefit and a drawback. Many styles are possible, so formatting can be inconsistent. Some constructs don't work well in all parsers and should be avoided. For example, here are some common/troublesome Markdown constructs.
markdownlint is an extension for the Visual Studio Code editor that includes a library of rules to encourage standards and consistency for Markdown files. It is powered by the markdownlint library for Node.js (which was inspired by markdownlint for Ruby). Linting is performed by the markdownlint-cli2 engine, which can be used in conjunction with this extension to provide command-line support for scripts and continuous integration scenarios. The markdownlint-cli2-action GitHub Action uses the same engine and can be integrated with project workflows.
Ctrl+P/Ctrl+P/⌘P to open the Quick Open dialogext install markdownlint to find the extensionInstall button, then the Enable buttonOR
Ctrl+Shift+X/Ctrl+Shift+X/⇧⌘X to open the Extensions tabmarkdownlint to find the extensionInstall button, then the Enable buttonOR
code --install-extension DavidAnson.vscode-markdownlintWhen editing a Markdown file in VS Code with markdownlint installed, any lines that violate one of markdownlint's rules (see below) will trigger a Warning in the editor. Warnings are indicated by a wavy green underline and can also be seen by pressing Ctrl+Shift+M/Ctrl+Shift+M/⇧⌘M to open the Errors and Warnings dialog. Hover the mouse pointer over a green line to see the warning or press F8 and Shift+F8/Shift+F8/⇧F8 to cycle through all the warnings (markdownlint warnings all begin with MD###). For more information about a markdownlint warning, place the cursor on a line and click the light bulb icon or press Ctrl+./Ctrl+./⌘. to open the quick fix dialog. Clicking one of the warnings in the dialog will display that rule's help entry in the default web browser.
For a tutorial, please see Build an Amazing Markdown Editor Using Visual Studio Code and Pandoc by Dave Johnson.
By default, markdownlint will scan and report issues for files that VS Code treats as Markdown. You can see what language mode the current file has in the Status Bar at the bottom of the window and you can change the language mode for the current file. If you have a custom file type that VS Code should always treat as Markdown, you can associate that file extension with the markdown language identifier.
See markdownlint's Rules.md file for more details.
The following rules can be automatically fixed by moving the cursor to a rule violation (wavy underlined text) and typing Ctrl+./Ctrl+./⌘. or clicking the light bulb icon.
All of a document's violations of the automatically-fixable rules above can be fixed for you.
markdownlint registers itself as a source code formatter for Markdown files and can be invoked by the Format Document/editor.action.formatDocument and Format Selection/editor.action.formatSelection commands, either from the Command Palette (via View|Command Palette... or Ctrl+Shift+P/Ctrl+Shift+P/⇧⌘P) or via the default key bindings of Shift+Alt+F/Ctrl+Shift+I/⇧⌥F (to format the document) and Ctrl+K Ctrl+F/Ctrl+K Ctrl+F/⌘K ⌘F (to format the selection).
To automatically format when saving or pasting into a Markdown document, configure Visual Studio Code's editor.formatOnSave or editor.formatOnPaste settings like so:
"[markdown]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
markdownlint also contributes the markdownlint.fixAll command which fixes a document's violations in one step and can be run from the Command Palette or by binding the command to a keyboard shortcut.
To automatically fix violations when saving a Markdown document, configure Visual Studio Code's editor.codeActionsOnSave setting like so:
"editor.codeActionsOnSave": {
"source.fixAll.markdownlint": "explicit"
}
Automatically-applied fixes from either method can be reverted by Edit|Undo or Ctrl+Z/Ctrl+Z/
$ claude mcp add vscode-markdownlint \
-- python -m otcore.mcp_server <graph>