mdx-formatter

Type to search...

to open search from anywhere

Headings

How the formatter normalizes heading styles and spacing

The formatter ensures blank lines after headings when followed by non-heading content.

Rules

  • A blank line is added after a heading when followed by non-heading content (paragraphs, lists, JSX, etc.)
  • Consecutive headings are left as-is without inserting blank lines between them
  • Blank lines are added after headings, not before them

Examples

Heading followed by content

Before:

# Heading
Content here

After:

# Heading

Content here

Heading followed by JSX

Before:

## Section Title
<ExImg src="/banner.jpg" alt="Banner" />

After:

## Section Title

<ExImg src="/banner.jpg" alt="Banner" />

Heading followed by list

Before:

## Features
- Item 1
- Item 2
- Item 3

After:

## Features

- Item 1
- Item 2
- Item 3

Revision History