Markdown Code Formatter

Install and Setup

In .dprintrc.json:

  1. Specify the plugin url in the "plugins" array.
  2. Ensure .md file extensions are matched in an "includes" pattern.
  3. Add a "markdown" configuration property if desired.
{
  // omitted...
  "markdown": {
    // markdown config goes here
  },
  "plugins": [
    "https://plugins.dprint.dev/markdown-x.x.x.wasm"
  ]
}

Code block formatters

Code blocks are formatted based on the other provided plugins. For example, if you wish to format JSON, TypeScript, and JavaScript code blocks, then ensure those plugins are also specified in the list of plugins to use.

{
  // omitted...
  "plugins": [
    "https://plugins.dprint.dev/typescript-x.x.x.wasm",
    "https://plugins.dprint.dev/json-x.x.x.wasm",
    "https://plugins.dprint.dev/markdown-x.x.x.wasm"
  ]
}

Configuration

See Configuration

Playground

See Playground

Ignore Comments

Use an ignore comment:

<!-- dprint-ignore -->
Some              text

Or a range ignore:

<!-- dprint-ignore-start -->

Some    text

* other    text
*           testing

<!-- dprint-ignore-end -->