2015-03-12 23:42:06 -07:00
|
|
|
# Rules
|
|
|
|
|
|
|
|
This document contains a description of all rules, what they are checking for,
|
|
|
|
as well as an examples of documents that break the rule and corrected
|
|
|
|
versions of the examples.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md001"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD001 - Heading levels should only increment by one level at a time
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: heading-increment, header-increment
|
2016-01-12 21:29:17 -08:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered when you skip heading levels in a markdown document, for
|
2015-03-12 23:42:06 -07:00
|
|
|
example:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
### Heading 3
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
We skipped out a 2nd level heading in this document
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
When using multiple heading levels, nested headings should increase by only one
|
2015-03-12 23:42:06 -07:00
|
|
|
level at a time:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
### Heading 3
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
#### Heading 4
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Another Heading 2
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
### Another Heading 3
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md002"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD002 - First heading should be a top level heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: first-heading-h1, first-header-h1
|
2016-01-12 21:29:17 -08:00
|
|
|
|
2016-07-04 23:23:29 -07:00
|
|
|
Parameters: level (number; default 1)
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered when the first heading in the document isn't a h1 heading:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
## This isn't a H1 heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
### Another heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
The first heading in the document should be a h1 heading:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Start with a H1 heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
## Then use a H2 for subsections
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-07-04 23:23:29 -07:00
|
|
|
Note: The `level` parameter can be used to change the top level (ex: to h2) in
|
|
|
|
cases where an h1 is added externally.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md003"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD003 - Heading style
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: heading-style, header-style
|
2016-01-12 21:29:17 -08:00
|
|
|
|
2016-02-23 21:22:46 -08:00
|
|
|
Parameters: style ("consistent", "atx", "atx_closed", "setext",
|
|
|
|
"setext_with_atx", "setext_with_atx_closed"; default "consistent")
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered when different heading styles (atx, setext, and 'closed'
|
2015-03-12 23:42:06 -07:00
|
|
|
atx) are used in the same document:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# ATX style H1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
## Closed ATX style H2 ##
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Setext style H1
|
|
|
|
===============
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Be consistent with the style of heading used in a document:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# ATX style H1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
## ATX style H2
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-09-06 09:35:37 +02:00
|
|
|
The setext_with_atx and setext_with_atx_closed doc styles allow atx-style
|
2018-03-19 23:39:42 +01:00
|
|
|
headings of level 3 or more in documents with setext style headings:
|
2015-07-29 22:17:33 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Setext style H1
|
|
|
|
===============
|
2015-07-29 22:17:33 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Setext style H2
|
|
|
|
---------------
|
2015-07-29 22:17:33 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
### ATX style H3
|
|
|
|
```
|
2015-07-29 22:17:33 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Note: the configured heading style can be a specific style to use (atx,
|
2016-02-23 21:22:46 -08:00
|
|
|
atx_closed, setext, setext_with_atx, setext_with_atx_closed), or simply require
|
|
|
|
that the usage be consistent within the document.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md004"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD004 - Unordered list style
|
|
|
|
|
|
|
|
Tags: bullet, ul
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: ul-style
|
|
|
|
|
2016-07-04 14:32:40 -07:00
|
|
|
Parameters: style ("consistent", "asterisk", "plus", "dash", "sublist"; default
|
|
|
|
"consistent")
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
This rule is triggered when the symbols used in the document for unordered
|
|
|
|
list items do not match the configured unordered list style:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Item 1
|
|
|
|
+ Item 2
|
|
|
|
- Item 3
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this issue, use the configured style for list items throughout the
|
|
|
|
document:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Item 1
|
|
|
|
* Item 2
|
|
|
|
* Item 3
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-07-04 14:32:40 -07:00
|
|
|
The configured list style can be a specific symbol to use (asterisk, plus, dash),
|
|
|
|
can require that usage be consistent within the document, or can require that each
|
|
|
|
sublist have a consistent symbol that is different from its parent list.
|
|
|
|
|
|
|
|
For example, the following is valid for the `sublist` style because the outer-most
|
|
|
|
indent uses asterisk, the middle indent uses plus, and the inner-most indent uses dash:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Item 1
|
|
|
|
+ Item 2
|
|
|
|
- Item 3
|
|
|
|
+ Item 4
|
|
|
|
* Item 4
|
|
|
|
+ Item 5
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md005"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD005 - Inconsistent indentation for list items at the same level
|
|
|
|
|
|
|
|
Tags: bullet, ul, indentation
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: list-indent
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when list items are parsed as being at the same level,
|
|
|
|
but don't have the same indentation:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Item 1
|
|
|
|
* Nested Item 1
|
|
|
|
* Nested Item 2
|
|
|
|
* A misaligned item
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Usually this rule will be triggered because of a typo. Correct the indentation
|
|
|
|
for the list to fix it:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Item 1
|
|
|
|
* Nested Item 1
|
|
|
|
* Nested Item 2
|
|
|
|
* Nested Item 3
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-06-15 22:37:12 -07:00
|
|
|
Sequentially-ordered list markers are usually left-aligned such that all items
|
|
|
|
have the same starting column:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
...
|
|
|
|
8. Item
|
|
|
|
9. Item
|
|
|
|
10. Item
|
|
|
|
11. Item
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
This rule also supports right-alignment of list markers such that all items have
|
|
|
|
the same ending column:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
...
|
|
|
|
8. Item
|
|
|
|
9. Item
|
|
|
|
10. Item
|
|
|
|
11. Item
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md006"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD006 - Consider starting bulleted lists at the beginning of the line
|
|
|
|
|
|
|
|
Tags: bullet, ul, indentation
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: ul-start-left
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when top level lists don't start at the beginning of a
|
|
|
|
line:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* List item
|
|
|
|
* List item
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix, ensure that top level list items are not indented:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some test
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* List item
|
|
|
|
* List item
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Rationale: Starting lists at the beginning of the line means that nested list
|
|
|
|
items can all be indented by the same amount when an editor's indent function
|
|
|
|
or the tab key is used to indent. Starting a list 1 space in means that the
|
|
|
|
indent of the first nested list is less than the indent of the second level (3
|
|
|
|
characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
|
|
|
|
|
2016-06-26 11:56:48 -07:00
|
|
|
Note: This rule is triggered for the following scenario because the unordered
|
|
|
|
sublist is not recognized as such by the parser. Not being nested 3 characters
|
|
|
|
as required by the outer ordered list, it creates a top-level unordered list
|
|
|
|
instead.
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
1. List item
|
|
|
|
- List item
|
|
|
|
- List item
|
|
|
|
1. List item
|
|
|
|
```
|
2016-06-26 11:56:48 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md007"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD007 - Unordered list indentation
|
|
|
|
|
|
|
|
Tags: bullet, ul, indentation
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: ul-indent
|
|
|
|
|
2015-03-18 09:38:32 -07:00
|
|
|
Parameters: indent (number; default 2)
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
This rule is triggered when list items are not indented by the configured
|
|
|
|
number of spaces (default: 2).
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* List item
|
|
|
|
* Nested list item indented by 3 spaces
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Corrected Example:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* List item
|
|
|
|
* Nested list item indented by 2 spaces
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Rationale (2 space indent): indenting by 2 spaces allows the content of a
|
|
|
|
nested list to be in line with the start of the content of the parent list
|
|
|
|
when a single space is used after the list marker.
|
|
|
|
|
|
|
|
Rationale (4 space indent): Same indent as code blocks, simpler for editors to
|
|
|
|
implement. See
|
|
|
|
<http://www.cirosantilli.com/markdown-styleguide/#indented-lists> for more
|
|
|
|
information.
|
|
|
|
|
|
|
|
In addition, this is a compatibility issue with multi-markdown parsers, which
|
|
|
|
require a 4 space indents. See
|
|
|
|
<http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>
|
|
|
|
for a description of the problem.
|
|
|
|
|
2016-06-26 11:56:48 -07:00
|
|
|
Note: This rule applies to a sublist only if its parent lists are all also
|
|
|
|
unordered (otherwise, extra indentation of ordered lists interferes with the
|
|
|
|
rule).
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md009"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD009 - Trailing spaces
|
|
|
|
|
|
|
|
Tags: whitespace
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-trailing-spaces
|
|
|
|
|
2018-04-30 21:34:19 -07:00
|
|
|
Parameters: br_spaces, list_item_empty_lines (number; default 2, boolean; default false)
|
2015-04-14 09:07:25 -07:00
|
|
|
|
2018-04-30 21:34:19 -07:00
|
|
|
This rule is triggered on any lines that end with unexpected whitespace. To fix this,
|
|
|
|
remove the trailing space from the end of the line.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-04-30 21:34:19 -07:00
|
|
|
The `br_spaces` parameter allows an exception to this rule for a specific number
|
|
|
|
of trailing spaces, typically used to insert an explicit line break. The default
|
|
|
|
value allows 2 spaces to indicate a hard break (\<br> element).
|
2015-04-14 09:07:25 -07:00
|
|
|
|
2018-04-30 21:34:19 -07:00
|
|
|
Note: You must set `br_spaces` to a value >= 2 for this parameter to take effect.
|
|
|
|
Setting `br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.
|
2015-04-14 09:07:25 -07:00
|
|
|
|
2017-05-11 21:44:41 -07:00
|
|
|
Using spaces to indent blank lines inside a list item is usually not necessary,
|
|
|
|
but some parsers require it. Set the `list_item_empty_lines` parameter to `true`
|
|
|
|
to allow this:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
- list item text
|
2018-04-30 21:34:19 -07:00
|
|
|
[2 spaces]
|
2018-03-09 22:50:01 -08:00
|
|
|
list item text
|
|
|
|
```
|
2017-05-11 21:44:41 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md010"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD010 - Hard tabs
|
|
|
|
|
|
|
|
Tags: whitespace, hard_tab
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-hard-tabs
|
|
|
|
|
2016-09-29 21:25:10 -07:00
|
|
|
Parameters: code_blocks (boolean; default true)
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered by any lines that contain hard tab characters instead
|
|
|
|
of using spaces for indentation. To fix this, replace any hard tab characters
|
|
|
|
with spaces instead.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* hard tab character used to indent the list item
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Corrected example:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* Spaces used to indent the list item instead
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-09-29 21:25:10 -07:00
|
|
|
You have the option to exclude this rule for code blocks. To do so, set the
|
|
|
|
`code_blocks` parameter to `false`. Code blocks are included by default since
|
|
|
|
handling of tabs by tools is often inconsistent (ex: using 4 vs. 8 spaces).
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md011"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD011 - Reversed link syntax
|
|
|
|
|
|
|
|
Tags: links
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-reversed-links
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when text that appears to be a link is encountered, but
|
|
|
|
where the syntax appears to have been reversed (the `[]` and `()` are
|
|
|
|
reversed):
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
(Incorrect link syntax)[http://www.example.com/]
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this, swap the `[]` and `()` around:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
[Correct link syntax](http://www.example.com/)
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-06-24 23:13:00 -07:00
|
|
|
Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style footnotes do not trigger this rule:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
For (example)[^1]
|
|
|
|
```
|
2016-06-24 23:13:00 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md012"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD012 - Multiple consecutive blank lines
|
|
|
|
|
|
|
|
Tags: whitespace, blank_lines
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-multiple-blanks
|
|
|
|
|
2016-10-03 21:42:44 -07:00
|
|
|
Parameters: maximum (number; default 1)
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when there are multiple consecutive blank lines in the
|
|
|
|
document:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text here
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Some more text here
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this, delete the offending lines:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text here
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Some more text here
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Note: this rule will not be triggered if there are multiple consecutive blank
|
|
|
|
lines inside code blocks.
|
|
|
|
|
2016-10-03 21:42:44 -07:00
|
|
|
Note: The `maximum` parameter can be used to configure the maximum number of
|
|
|
|
consecutive blank lines.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md013"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD013 - Line length
|
|
|
|
|
|
|
|
Tags: line_length
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: line-length
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Parameters: line_length, code_blocks, tables, headings, headers (number; default 80, boolean; default true)
|
|
|
|
|
2018-04-18 22:25:45 -07:00
|
|
|
> If `headings` is not provided, `headers` (deprecated) will be used.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
This rule is triggered when there are lines that are longer than the
|
|
|
|
configured line length (default: 80 characters). To fix this, split the line
|
|
|
|
up into multiple lines.
|
|
|
|
|
|
|
|
This rule has an exception where there is no whitespace beyond the configured
|
|
|
|
line length. This allows you to still include items such as long URLs without
|
|
|
|
being forced to break them in the middle.
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
You have the option to exclude this rule for code blocks, tables, or headings.
|
|
|
|
To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
|
2016-01-09 22:20:36 -08:00
|
|
|
|
|
|
|
Code blocks are included in this rule by default since it is often a
|
|
|
|
requirement for document readability, and tentatively compatible with code
|
|
|
|
rules. Still, some languages do not lend themselves to short lines.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md014"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD014 - Dollar signs used before commands without showing output
|
|
|
|
|
|
|
|
Tags: code
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: commands-show-output
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when there are code blocks showing shell commands to be
|
|
|
|
typed, and the shell commands are preceded by dollar signs ($):
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
$ ls
|
|
|
|
$ cat foo
|
|
|
|
$ less bar
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
The dollar signs are unnecessary in the above situation, and should not be
|
|
|
|
included:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
ls
|
|
|
|
cat foo
|
|
|
|
less bar
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
However, an exception is made when there is a need to distinguish between
|
|
|
|
typed commands and command output, as in the following example:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
$ ls
|
|
|
|
foo bar
|
|
|
|
$ cat foo
|
|
|
|
Hello world
|
|
|
|
$ cat bar
|
|
|
|
baz
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Rationale: it is easier to copy and paste and less noisy if the dollar signs
|
|
|
|
are omitted when they are not needed. See
|
|
|
|
<http://www.cirosantilli.com/markdown-styleguide/#dollar-signs-in-shell-code>
|
|
|
|
for more information.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md018"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD018 - No space after hash on atx style heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers, atx, spaces
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-missing-space-atx
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when spaces are missing after the hash characters
|
2018-03-19 23:39:42 +01:00
|
|
|
in an atx style heading:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
#Heading 1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
##Heading 2
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, separate the heading text from the hash character by a single
|
2015-03-12 23:42:06 -07:00
|
|
|
space:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md019"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD019 - Multiple spaces after hash on atx style heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers, atx, spaces
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-multiple-space-atx
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when more than one space is used to separate the
|
2018-03-19 23:39:42 +01:00
|
|
|
heading text from the hash characters in an atx style heading:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, separate the heading text from the hash character by a single
|
2015-03-12 23:42:06 -07:00
|
|
|
space:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md020"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD020 - No space inside hashes on closed atx style heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers, atx_closed, spaces
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-missing-space-closed-atx
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when spaces are missing inside the hash characters
|
2018-03-19 23:39:42 +01:00
|
|
|
in a closed atx style heading:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
#Heading 1#
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
##Heading 2##
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, separate the heading text from the hash character by a single
|
2015-03-12 23:42:06 -07:00
|
|
|
space:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1 #
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2 ##
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Note: this rule will fire if either side of the heading is missing spaces.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md021"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD021 - Multiple spaces inside hashes on closed atx style heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers, atx_closed, spaces
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-multiple-space-closed-atx
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when more than one space is used to separate the
|
2018-03-19 23:39:42 +01:00
|
|
|
heading text from the hash characters in a closed atx style heading:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1 #
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2 ##
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, separate the heading text from the hash character by a single
|
2015-03-12 23:42:06 -07:00
|
|
|
space:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1 #
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2 ##
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Note: this rule will fire if either side of the heading contains multiple
|
2015-03-12 23:42:06 -07:00
|
|
|
spaces.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md022"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD022 - Headings should be surrounded by blank lines
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers, blank_lines
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: blanks-around-headings, blanks-around-headers
|
2016-01-12 21:29:17 -08:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered when headings (any style) are either not preceded or not
|
2015-03-12 23:42:06 -07:00
|
|
|
followed by a blank line:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1
|
2018-03-09 22:50:01 -08:00
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Some more text
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, ensure that all headings have a blank line both before and after
|
|
|
|
(except where the heading is at the beginning or end of the document):
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading 1
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Some more text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading 2
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
|
2018-03-19 23:39:42 +01:00
|
|
|
not parse headings that don't have a blank line before, and will parse them as
|
2015-03-12 23:42:06 -07:00
|
|
|
regular text.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md023"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD023 - Headings must start at the beginning of the line
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers, spaces
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: heading-start-left, header-start-left
|
2016-01-12 21:29:17 -08:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered when a heading is indented by one or more spaces:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
# Indented heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, ensure that all headings start at the beginning of the line:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
# Heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Rationale: Headings that don't start at the beginning of the line will not be
|
|
|
|
parsed as headings, and will instead appear as regular text.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md024"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD024 - Multiple headings with the same content
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: no-duplicate-heading, no-duplicate-header
|
2016-01-12 21:29:17 -08:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered if there are multiple headings in the document that have
|
2015-03-12 23:42:06 -07:00
|
|
|
the same text:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
## Some text
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, ensure that the content of each heading is different:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
## Some more text
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Rationale: Some markdown parses generate anchors for headings based on the
|
|
|
|
heading name, and having headings with the same content can cause problems with
|
2015-03-12 23:42:06 -07:00
|
|
|
this.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md025"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD025 - Multiple top level headings in the same document
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: single-h1
|
|
|
|
|
2016-07-04 23:23:29 -07:00
|
|
|
Parameters: level (number; default 1)
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered when a top level heading is in use (the first line of
|
|
|
|
the file is a h1 heading), and more than one h1 heading is in use in the
|
2015-03-12 23:42:06 -07:00
|
|
|
document:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Top level heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
# Another top level heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix, structure your document so that there is a single h1 heading that is
|
|
|
|
the title for the document, and all later headings are h2 or lower level
|
|
|
|
headings:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# Title
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## Another heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Rationale: A top level heading is a h1 on the first line of the file, and
|
2015-03-12 23:42:06 -07:00
|
|
|
serves as the title for the document. If this convention is in use, then there
|
|
|
|
can not be more than one title for the document, and the entire document
|
2018-03-19 23:39:42 +01:00
|
|
|
should be contained within this heading.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-07-04 23:23:29 -07:00
|
|
|
Note: The `level` parameter can be used to change the top level (ex: to h2) in
|
|
|
|
cases where an h1 is added externally.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md026"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD026 - Trailing punctuation in heading
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-trailing-punctuation
|
|
|
|
|
2015-03-18 09:38:32 -07:00
|
|
|
Parameters: punctuation (string; default ".,;:!?")
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered on any heading that has a punctuation character as the
|
2015-03-12 23:42:06 -07:00
|
|
|
last character in the line:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# This is a heading.
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this, remove any trailing punctuation:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# This is a heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Note: The punctuation parameter can be used to specify what characters class
|
2018-03-19 23:39:42 +01:00
|
|
|
as punctuation at the end of the heading. For example, you can set it to
|
|
|
|
`".,;:!"` to allow headings with question marks in them, such as might be used
|
2015-03-12 23:42:06 -07:00
|
|
|
in an FAQ.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md027"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD027 - Multiple spaces after blockquote symbol
|
|
|
|
|
|
|
|
Tags: blockquote, whitespace, indentation
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-multiple-space-blockquote
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when blockquotes have more than one space after the
|
|
|
|
blockquote (`>`) symbol:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
> This is a block quote with bad indentation
|
|
|
|
> there should only be one.
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix, remove any extraneous space:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
> This is a blockquote with correct
|
|
|
|
> indentation.
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md028"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD028 - Blank line inside blockquote
|
|
|
|
|
|
|
|
Tags: blockquote, whitespace
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-blanks-blockquote
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when two blockquote blocks are separated by nothing
|
|
|
|
except for a blank line:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
> This is a blockquote
|
|
|
|
> which is immediately followed by
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
> this blockquote. Unfortunately
|
|
|
|
> In some parsers, these are treated as the same blockquote.
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this, ensure that any blockquotes that are right next to each other
|
|
|
|
have some text in between:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
> This is a blockquote.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
And Jimmy also said:
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
> This too is a blockquote.
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Alternatively, if they are supposed to be the same quote, then add the
|
|
|
|
blockquote symbol at the beginning of the blank line:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
> This is a blockquote.
|
|
|
|
>
|
|
|
|
> This is the same blockquote.
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Rationale: Some markdown parsers will treat two blockquotes separated by one
|
|
|
|
or more blank lines as the same blockquote, while others will treat them as
|
|
|
|
separate blockquotes.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md029"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD029 - Ordered list item prefix
|
|
|
|
|
|
|
|
Tags: ol
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: ol-prefix
|
|
|
|
|
2017-12-12 22:41:11 -08:00
|
|
|
Parameters: style ("one", "ordered", "one_or_ordered"; default "one_or_ordered")
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
This rule is triggered on ordered lists that do not either start with '1.' or
|
|
|
|
do not have a prefix that increases in numerical order (depending on the
|
2017-12-12 22:41:11 -08:00
|
|
|
configured style).
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Example valid list if the style is configured as 'one':
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
1. Do this.
|
|
|
|
1. Do that.
|
|
|
|
1. Done.
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Example valid list if the style is configured as 'ordered':
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
1. Do this.
|
|
|
|
2. Do that.
|
|
|
|
3. Done.
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2017-12-12 22:41:11 -08:00
|
|
|
Both examples are valid when the style is configured as 'one_or_ordered'.
|
|
|
|
|
|
|
|
Example invalid list for all styles:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
1. Do this.
|
|
|
|
3. Done.
|
|
|
|
```
|
2017-12-12 22:41:11 -08:00
|
|
|
|
2018-06-15 22:37:12 -07:00
|
|
|
This rule supports 0-prefixing ordered list items for uniform indentation:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
...
|
|
|
|
08. Item
|
|
|
|
09. Item
|
|
|
|
10. Item
|
|
|
|
11. Item
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md030"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD030 - Spaces after list markers
|
|
|
|
|
|
|
|
Tags: ol, ul, whitespace
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: list-marker-space
|
|
|
|
|
2016-07-02 22:37:52 -07:00
|
|
|
Parameters: ul_single, ol_single, ul_multi, ol_multi (number; default 1)
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
This rule checks for the number of spaces between a list marker (e.g. '`-`',
|
|
|
|
'`*`', '`+`' or '`1.`') and the text of the list item.
|
|
|
|
|
|
|
|
The number of spaces checked for depends on the document style in use, but the
|
|
|
|
default is 1 space after any list marker:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Foo
|
|
|
|
* Bar
|
|
|
|
* Baz
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
1. Foo
|
|
|
|
1. Bar
|
|
|
|
1. Baz
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
1. Foo
|
|
|
|
* Bar
|
|
|
|
1. Baz
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
A document style may change the number of spaces after unordered list items
|
|
|
|
and ordered list items independently, as well as based on whether the content
|
|
|
|
of every item in the list consists of a single paragraph, or multiple
|
|
|
|
paragraphs (including sub-lists and code blocks).
|
|
|
|
|
|
|
|
For example, the style guide at
|
|
|
|
<http://www.cirosantilli.com/markdown-styleguide/#spaces-after-marker>
|
|
|
|
specifies that 1 space after the list marker should be used if every item in
|
|
|
|
the list fits within a single paragraph, but to use 2 or 3 spaces (for ordered
|
|
|
|
and unordered lists respectively) if there are multiple paragraphs of content
|
|
|
|
inside the list:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Foo
|
|
|
|
* Bar
|
|
|
|
* Baz
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
vs.
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* Foo
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Second paragraph
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* Bar
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
or
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
1. Foo
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Second paragraph
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
1. Bar
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this, ensure the correct number of spaces are used after list marker
|
|
|
|
for your selected document style.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md031"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD031 - Fenced code blocks should be surrounded by blank lines
|
|
|
|
|
|
|
|
Tags: code, blank_lines
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: blanks-around-fences
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when fenced code blocks are either not preceded or not
|
|
|
|
followed by a blank line:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
````markdown
|
|
|
|
Some text
|
|
|
|
```
|
|
|
|
Code block
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
|
|
|
Another code block
|
|
|
|
```
|
|
|
|
Some more text
|
|
|
|
````
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this, ensure that all fenced code blocks have a blank line both before
|
|
|
|
and after (except where the block is at the beginning or end of the document):
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
````markdown
|
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
|
|
|
Code block
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
|
|
|
Another code block
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Some more text
|
|
|
|
````
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
|
|
|
|
not parse fenced code blocks that don't have blank lines before and after them.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md032"></a>
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
## MD032 - Lists should be surrounded by blank lines
|
|
|
|
|
|
|
|
Tags: bullet, ul, ol, blank_lines
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: blanks-around-lists
|
|
|
|
|
2015-03-12 23:42:06 -07:00
|
|
|
This rule is triggered when lists (of any kind) are either not preceded or not
|
|
|
|
followed by a blank line:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text
|
|
|
|
* Some
|
|
|
|
* List
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
1. Some
|
|
|
|
2. List
|
|
|
|
Some text
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
To fix this, ensure that all lists have a blank line both before and after
|
|
|
|
(except where the block is at the beginning or end of the document):
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Some text
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* Some
|
|
|
|
* List
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
1. Some
|
|
|
|
2. List
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Some text
|
|
|
|
```
|
2015-03-12 23:42:06 -07:00
|
|
|
|
|
|
|
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
|
|
|
|
not parse lists that don't have blank lines before and after them.
|
|
|
|
|
|
|
|
Note: List items without hanging indents are a violation of this rule; list
|
|
|
|
items with hanging indents are okay:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
* This is
|
|
|
|
not okay
|
2015-03-12 23:42:06 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* This is
|
|
|
|
okay
|
|
|
|
```
|
2015-04-13 08:47:15 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md033"></a>
|
|
|
|
|
2015-04-13 08:47:15 -07:00
|
|
|
## MD033 - Inline HTML
|
|
|
|
|
|
|
|
Tags: html
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-inline-html
|
|
|
|
|
2015-12-15 21:30:37 -08:00
|
|
|
Parameters: allowed_elements (array of string; default empty)
|
|
|
|
|
2015-04-13 08:47:15 -07:00
|
|
|
This rule is triggered whenever raw HTML is used in a markdown document:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
<h1>Inline HTML heading</h1>
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-04-13 08:47:15 -07:00
|
|
|
|
|
|
|
To fix this, use 'pure' markdown instead of including raw HTML:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# Markdown heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-04-13 08:47:15 -07:00
|
|
|
|
|
|
|
Rationale: Raw HTML is allowed in markdown, but this rule is included for
|
|
|
|
those who want their documents to only include "pure" markdown, or for those
|
|
|
|
who are rendering markdown documents in something other than HTML.
|
2015-04-14 00:01:57 -07:00
|
|
|
|
2015-12-15 21:30:37 -08:00
|
|
|
Note: To allow specific HTML elements, use the 'allowed_elements' parameter.
|
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md034"></a>
|
|
|
|
|
2015-04-14 00:01:57 -07:00
|
|
|
## MD034 - Bare URL used
|
|
|
|
|
|
|
|
Tags: links, url
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-bare-urls
|
|
|
|
|
2015-04-14 00:01:57 -07:00
|
|
|
This rule is triggered whenever a URL is given that isn't surrounded by angle
|
|
|
|
brackets:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
For more information, see http://www.example.com/.
|
|
|
|
```
|
2015-04-14 00:01:57 -07:00
|
|
|
|
|
|
|
To fix this, add angle brackets around the URL:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
For more information, see <http://www.example.com/>.
|
|
|
|
```
|
2015-04-14 00:01:57 -07:00
|
|
|
|
|
|
|
Rationale: Without angle brackets, the URL isn't converted into a link in many
|
|
|
|
markdown parsers.
|
|
|
|
|
|
|
|
Note: if you do want a bare URL without it being converted into a link,
|
|
|
|
enclose it in a code block, otherwise in some markdown parsers it _will_ be
|
|
|
|
converted:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
`http://www.example.com`
|
|
|
|
```
|
2015-04-14 09:40:16 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md035"></a>
|
|
|
|
|
2015-04-14 09:40:16 -07:00
|
|
|
## MD035 - Horizontal rule style
|
|
|
|
|
|
|
|
Tags: hr
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: hr-style
|
|
|
|
|
2015-04-14 09:40:16 -07:00
|
|
|
Parameters: style ("consistent", "---", "***", or other string specifying the
|
|
|
|
horizontal rule; default "consistent")
|
|
|
|
|
|
|
|
This rule is triggered when inconsistent styles of horizontal rules are used
|
|
|
|
in the document:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
---
|
2015-04-14 09:40:16 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
- - -
|
2015-04-14 09:40:16 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
***
|
2015-04-14 09:40:16 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
* * *
|
2015-04-14 09:40:16 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
****
|
|
|
|
```
|
2015-04-14 09:40:16 -07:00
|
|
|
|
|
|
|
To fix this, ensure any horizontal rules used in the document are consistent,
|
|
|
|
or match the given style if the rule is so configured:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
---
|
2015-04-14 09:40:16 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
---
|
|
|
|
```
|
2015-04-14 09:40:16 -07:00
|
|
|
|
|
|
|
Note: by default, this rule is configured to just require that all horizontal
|
|
|
|
rules in the document are the same, and will trigger if any of the horizontal
|
|
|
|
rules are different than the first one encountered in the document. If you
|
|
|
|
want to configure the rule to match a specific style, the parameter given to
|
|
|
|
the 'style' option is a string containing the exact horizontal rule text that
|
|
|
|
is allowed.
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md036"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD036 - Emphasis used instead of a heading
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers, emphasis
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: no-emphasis-as-heading, no-emphasis-as-header
|
2016-01-12 21:29:17 -08:00
|
|
|
|
2016-09-24 16:15:54 -07:00
|
|
|
Parameters: punctuation (string; default ".,;:!?")
|
|
|
|
|
2015-04-14 22:37:56 -07:00
|
|
|
This check looks for instances where emphasized (i.e. bold or italic) text is
|
2018-03-19 23:39:42 +01:00
|
|
|
used to separate sections, where a heading should be used instead:
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
**My document**
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Lorem ipsum dolor sit amet...
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
_Another section_
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Consectetur adipiscing elit, sed do eiusmod.
|
|
|
|
```
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, use markdown headings instead of emphasized text to denote
|
2015-04-14 22:37:56 -07:00
|
|
|
sections:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# My document
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Lorem ipsum dolor sit amet...
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
## Another section
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Consectetur adipiscing elit, sed do eiusmod.
|
|
|
|
```
|
2015-04-14 22:37:56 -07:00
|
|
|
|
2016-09-24 16:15:54 -07:00
|
|
|
Note: this rule looks for single line paragraphs that consist entirely of
|
|
|
|
emphasized text. It won't fire on emphasis used within regular text,
|
|
|
|
multi-line emphasized paragraphs, and paragraphs ending in punctuation.
|
|
|
|
Similarly to rule MD026, you can configure what characters are recognized as
|
|
|
|
punctuation.
|
2015-04-15 17:50:01 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md037"></a>
|
|
|
|
|
2015-04-15 17:50:01 -07:00
|
|
|
## MD037 - Spaces inside emphasis markers
|
|
|
|
|
|
|
|
Tags: whitespace, emphasis
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-space-in-emphasis
|
|
|
|
|
2015-04-15 17:50:01 -07:00
|
|
|
This rule is triggered when emphasis markers (bold, italic) are used, but they
|
|
|
|
have spaces between the markers and the text:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Here is some ** bold ** text.
|
2015-04-15 17:50:01 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Here is some * italic * text.
|
2015-04-15 17:50:01 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Here is some more __ bold __ text.
|
2015-04-15 17:50:01 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Here is some more _ italic _ text.
|
|
|
|
```
|
2015-04-15 17:50:01 -07:00
|
|
|
|
|
|
|
To fix this, remove the spaces around the emphasis markers:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
Here is some **bold** text.
|
2015-04-15 17:50:01 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Here is some *italic* text.
|
2015-04-15 17:50:01 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Here is some more __bold__ text.
|
2015-04-15 17:50:01 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
Here is some more _italic_ text.
|
|
|
|
```
|
2015-04-15 17:50:01 -07:00
|
|
|
|
|
|
|
Rationale: Emphasis is only parsed as such when the asterisks/underscores
|
|
|
|
aren't completely surrounded by spaces. This rule attempts to detect where
|
|
|
|
they were surrounded by spaces, but it appears that emphasized text was
|
|
|
|
intended by the author.
|
2015-04-15 18:24:42 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md038"></a>
|
|
|
|
|
2015-04-15 18:24:42 -07:00
|
|
|
## MD038 - Spaces inside code span elements
|
|
|
|
|
|
|
|
Tags: whitespace, code
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-space-in-code
|
|
|
|
|
2015-04-15 18:24:42 -07:00
|
|
|
This rule is triggered on code span elements that have spaces right inside the
|
|
|
|
backticks:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
` some text `
|
2015-04-15 18:24:42 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
`some text `
|
2015-04-15 18:24:42 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
` some text`
|
|
|
|
```
|
2015-04-15 18:24:42 -07:00
|
|
|
|
|
|
|
To fix this, remove the spaces inside the codespan markers:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
`some text`
|
|
|
|
```
|
2015-04-15 18:24:42 -07:00
|
|
|
|
2017-02-18 22:56:06 -08:00
|
|
|
Note: A single leading or trailing space is allowed if used to separate codespan
|
|
|
|
markers from an embedded backtick:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
`` ` embedded backtick``
|
|
|
|
```
|
2017-02-18 22:56:06 -08:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md039"></a>
|
|
|
|
|
2015-04-15 18:24:42 -07:00
|
|
|
## MD039 - Spaces inside link text
|
|
|
|
|
|
|
|
Tags: whitespace, links
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: no-space-in-links
|
|
|
|
|
2015-04-15 18:24:42 -07:00
|
|
|
This rule is triggered on links that have spaces surrounding the link text:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
[ a link ](http://www.example.com/)
|
|
|
|
```
|
2015-04-15 18:24:42 -07:00
|
|
|
|
|
|
|
To fix this, remove the spaces surrounding the link text:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
[a link](http://www.example.com/)
|
|
|
|
```
|
2015-04-16 09:13:56 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md040"></a>
|
|
|
|
|
2015-04-16 09:13:56 -07:00
|
|
|
## MD040 - Fenced code blocks should have a language specified
|
|
|
|
|
|
|
|
Tags: code, language
|
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: fenced-code-language
|
|
|
|
|
2015-04-16 09:13:56 -07:00
|
|
|
This rule is triggered when fenced code blocks are used, but a language isn't
|
|
|
|
specified:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
````markdown
|
|
|
|
```
|
|
|
|
#!/bin/bash
|
|
|
|
echo Hello world
|
|
|
|
```
|
|
|
|
````
|
2015-04-16 09:13:56 -07:00
|
|
|
|
|
|
|
To fix this, add a language specifier to the code block:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
````markdown
|
|
|
|
```bash
|
|
|
|
#!/bin/bash
|
|
|
|
echo Hello world
|
|
|
|
```
|
|
|
|
````
|
2015-07-20 22:06:48 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md041"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD041 - First line in file should be a top level heading
|
2015-07-20 22:06:48 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Tags: headings, headers
|
2015-07-20 22:06:48 -07:00
|
|
|
|
2016-01-12 21:29:17 -08:00
|
|
|
Aliases: first-line-h1
|
|
|
|
|
2017-05-06 15:25:14 -07:00
|
|
|
Parameters: level, front_matter_title (number; default 1, string; default "^\s*title:")
|
2016-07-04 23:23:29 -07:00
|
|
|
|
2015-07-20 22:06:48 -07:00
|
|
|
This rule is triggered when the first line in the file isn't a top level (h1)
|
2018-03-19 23:39:42 +01:00
|
|
|
heading:
|
2015-07-20 22:06:48 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
This is a file without a heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2015-07-20 22:06:48 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To fix this, add a heading to the top of your file:
|
2015-07-20 22:06:48 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
2018-03-19 23:39:42 +01:00
|
|
|
# File with heading
|
2015-07-20 22:06:48 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This is a file with a top level heading
|
2018-03-09 22:50:01 -08:00
|
|
|
```
|
2016-06-27 22:19:02 -07:00
|
|
|
|
2017-05-06 15:25:14 -07:00
|
|
|
The `level` parameter can be used to change the top level (ex: to h2) in cases
|
|
|
|
where an h1 is added externally.
|
|
|
|
|
|
|
|
If front matter is present and contains a [YAML](https://en.wikipedia.org/wiki/YAML)
|
|
|
|
`title` property (commonly used with blog posts), this rule will not report a
|
|
|
|
violation. To use a different property name in front matter, specify the text
|
|
|
|
of a regular expression via the `front_matter_title` parameter. To disable the
|
|
|
|
use of front matter by this rule, specify `""` for `front_matter_title`.
|
2016-07-04 23:23:29 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md042"></a>
|
|
|
|
|
2016-06-27 22:19:02 -07:00
|
|
|
## MD042 - No empty links
|
|
|
|
|
|
|
|
Tags: links
|
|
|
|
|
|
|
|
Aliases: no-empty-links
|
|
|
|
|
|
|
|
This rule is triggered when an empty link is encountered:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
[an empty link]()
|
|
|
|
```
|
2016-06-27 22:19:02 -07:00
|
|
|
|
|
|
|
To fix the violation, provide a destination for the link:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
[a valid link](https://example.com/)
|
|
|
|
```
|
2016-06-27 22:19:02 -07:00
|
|
|
|
|
|
|
Empty fragments will trigger this rule:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
[an empty fragment](#)
|
|
|
|
```
|
2016-06-27 22:19:02 -07:00
|
|
|
|
|
|
|
But non-empty fragments will not:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
[a valid fragment](#fragment)
|
|
|
|
```
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md043"></a>
|
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
## MD043 - Required heading structure
|
|
|
|
|
|
|
|
Tags: headings, headers
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Aliases: required-headings, required-headers
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Parameters: headings, headers (array of string; default `null` for disabled)
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-04-18 22:25:45 -07:00
|
|
|
> If `headings` is not provided, `headers` (deprecated) will be used.
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
This rule is triggered when the headings in a file do not match the array of
|
|
|
|
headings passed to the rule. It can be used to enforce a standard heading
|
2016-07-02 22:37:52 -07:00
|
|
|
structure for a set of files.
|
|
|
|
|
|
|
|
To require exactly the following structure:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# Head
|
|
|
|
## Item
|
|
|
|
### Detail
|
|
|
|
```
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Set the `headings` parameter to:
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```json
|
|
|
|
[
|
|
|
|
"# Head",
|
|
|
|
"## Item",
|
|
|
|
"### Detail"
|
|
|
|
]
|
|
|
|
```
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
To allow optional headings as with the following structure:
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```markdown
|
|
|
|
# Head
|
|
|
|
## Item
|
|
|
|
### Detail (optional)
|
|
|
|
## Foot
|
|
|
|
### Notes (optional)
|
|
|
|
```
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Use the special value `"*"` meaning "one or more unspecified headings" and set
|
|
|
|
the `headings` parameter to:
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```json
|
|
|
|
[
|
|
|
|
"# Head",
|
|
|
|
"## Item",
|
|
|
|
"*",
|
|
|
|
"## Foot",
|
|
|
|
"*"
|
|
|
|
]
|
|
|
|
```
|
2016-07-02 22:37:52 -07:00
|
|
|
|
|
|
|
When an error is detected, this rule outputs the line number of the first
|
2018-03-19 23:39:42 +01:00
|
|
|
problematic heading (otherwise, it outputs the last line number of the file).
|
2016-07-02 22:37:52 -07:00
|
|
|
|
2018-03-19 23:39:42 +01:00
|
|
|
Note that while the `headings` parameter uses the "## Text" ATX heading style for
|
|
|
|
simplicity, a file may use any supported heading style.
|
2016-12-22 13:34:18 -08:00
|
|
|
|
2017-05-07 12:48:04 -07:00
|
|
|
<a name="md044"></a>
|
|
|
|
|
2016-12-22 13:34:18 -08:00
|
|
|
## MD044 - Proper names should have the correct capitalization
|
|
|
|
|
|
|
|
Tags: spelling
|
|
|
|
|
|
|
|
Aliases: proper-names
|
|
|
|
|
2017-03-18 19:47:26 -07:00
|
|
|
Parameters: names, code_blocks (string array; default `null`, boolean; default `true`)
|
2016-12-22 13:34:18 -08:00
|
|
|
|
|
|
|
This rule is triggered when any of the strings in the `names` array do not have
|
|
|
|
the specified capitalization. It can be used to enforce a standard letter case
|
|
|
|
for the names of projects and products.
|
|
|
|
|
|
|
|
For example, the language "JavaScript" is usually written with both the 'J' and
|
|
|
|
'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To enforce
|
|
|
|
the proper capitalization, specify the desired letter case in the `names` array:
|
|
|
|
|
2018-03-09 22:50:01 -08:00
|
|
|
```json
|
|
|
|
[
|
|
|
|
"JavaScript"
|
|
|
|
]
|
|
|
|
```
|
2017-03-18 19:47:26 -07:00
|
|
|
|
|
|
|
Set the `code_blocks` parameter to `false` to disable this rule for code blocks.
|
2017-12-29 17:01:21 -08:00
|
|
|
|
|
|
|
<a name="md045"></a>
|
|
|
|
|
2018-01-06 18:06:32 -08:00
|
|
|
## MD045 - Images should have alternate text (alt text)
|
2017-12-29 17:01:21 -08:00
|
|
|
|
|
|
|
Tags: accessibility, images
|
|
|
|
|
|
|
|
Aliases: no-alt-text
|
|
|
|
|
2018-01-06 18:06:32 -08:00
|
|
|
This rule is triggered when an image is missing alternate text (alt text) information.
|
|
|
|
Alternate text is important for accessibility, describing the content of an image for
|
|
|
|
people who may not be able to see it.
|
|
|
|
|
|
|
|
Alternate text is commonly specified inline as:
|
|
|
|
|
2018-03-03 22:22:02 -08:00
|
|
|
```markdown
|
2018-01-06 18:06:32 -08:00
|
|
|

|
|
|
|
```
|
|
|
|
|
|
|
|
Or with reference syntax as:
|
|
|
|
|
2018-03-03 22:22:02 -08:00
|
|
|
```markdown
|
2018-01-06 18:06:32 -08:00
|
|
|
![Alternate text][ref]
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
[ref]: image.jpg "Optional title"
|
|
|
|
```
|
|
|
|
|
|
|
|
Guidance for writing alternate text is available from the [W3C](https://www.w3.org/WAI/alt/),
|
|
|
|
[Wikipedia](https://en.wikipedia.org/wiki/Alt_attribute), and
|
|
|
|
[other locations](https://www.phase2technology.com/blog/no-more-excuses-definitive-guide-alt-text-field).
|