Headings

Key Point

๐Ÿ’ก Always use short and understandable headings.

ATX Style

Always use atx-style headings (not closed) instead of Setext.

The level can be seen and the number of characters must not match in both lines.

ATX also works for all levels, while Setex only goes up to level 2.

remark-lint: heading-style

๐Ÿ‘ Correct code for this rule:

# Winter

## Frost

### Snow

๐Ÿ‘Ž Incorrect code for this rule:

Winter
======

Frost
-----

No closed ATX styled headings:

# Winter #

## Frost ##

### Snow ###

Empty lines before and after

Always surround headers by a single empty line except at the beginning of the file.

๐Ÿ‘ Correct code for this rule:

... snowflakes are falling.

# Winter

Sparkling and frozen...

๐Ÿ‘Ž Incorrect code for this rule:

... snowflakes are falling.
# Winter
Sparkling and frozen...
... snowflakes are falling.


# Winter


Sparkling and frozen...

Content spacing

Always separate the marker character # from the actual header content using a single whitespace.

remark-lint: no-heading-content-indent

๐Ÿ‘ Correct code for this rule:

# Winter

๐Ÿ‘Ž Incorrect code for this rule:

#Winter
#  Winter

No Content Before

Make sure that there are no other characters (including whitespaces) in front of headings.

remark-lint: no-heading-indent

๐Ÿ‘ Correct code for this rule:

# Winter

Note

Note: The ยท character represents a whitespace character.

๐Ÿ‘Ž Incorrect code for this rule:

.# Winter
ยท# Winter

Sentences case

Use an upper case letter as the first letter of a header, unless it is a word that always starts with lowercase letters, for example proper names or code snippets.

๐Ÿ‘ Correct code for this rule:

# The quick brown fox jumps over the lazy dog

Proper names or code snippets:

# React

# `string`

# init main

๐Ÿ‘Ž Incorrect code for this rule:

# winter is sparkling and frozen

Proper names or code snippets:

# react

# `String`

# Init

Length

Prefer using short header with a maximum length of 80 character (without markers).

Instead of using a long sentence, make the header a summary and write the long sentence as the first paragraph beneath the header.

This makes it effortless to refer to the header later, specially if automatic IDs or a TOC (Table Of Content) are created.

remark-lint: maximum-heading-length

๐Ÿ‘ Correct code for this rule:

# Winter

The winter is sparkling and frozen and soft snowflakes are falling down on the world!

๐Ÿ‘Ž Incorrect code for this rule:

# The winter is sparkling and frozen and soft snowflakes are falling down on the world!

Punctuation after content

Do not use any punctuation at the end of a header for example a trailing (semi)colon ;:, period ., closing marker # or any "sentence amplifier" (!?).

Every header is an introduction to what is about to come next, which is exactly the function of a colon.

Also the header is not a sentence, or at least only a short sentence, so there is not need to add a sentence separator to it.

remark-lint: no-heading-punctuation

๐Ÿ‘ Correct code for this rule:

# Winter

Sparkling and frozen.

๐Ÿ‘Ž Incorrect code for this rule:

# Winter: Sparkling
# Winter. Frozen.
# Winter #
Last Updated: 6/21/2019, 4:15:31 PM