Fix grammar issues in Rules.md.

This commit is contained in:
Yash Singh 2020-12-28 13:28:38 -08:00 committed by David Anson
parent 55360058c5
commit 2a198a5ee4
13 changed files with 93 additions and 93 deletions

View file

@ -57,7 +57,7 @@ playground for learning and exploring.
## Rules / Aliases ## Rules / Aliases
* **[MD001](doc/Rules.md#md001)** *heading-increment/header-increment* - Heading levels should only increment by one level at a time * **[MD001](doc/Rules.md#md001)** *heading-increment/header-increment* - Heading levels should only increment by one level at a time
* ~~**[MD002](doc/Rules.md#md002)** *first-heading-h1/first-header-h1* - First heading should be a top level heading~~ * ~~**[MD002](doc/Rules.md#md002)** *first-heading-h1/first-header-h1* - First heading should be a top-level heading~~
* **[MD003](doc/Rules.md#md003)** *heading-style/header-style* - Heading style * **[MD003](doc/Rules.md#md003)** *heading-style/header-style* - Heading style
* **[MD004](doc/Rules.md#md004)** *ul-style* - Unordered list style * **[MD004](doc/Rules.md#md004)** *ul-style* - Unordered list style
* **[MD005](doc/Rules.md#md005)** *list-indent* - Inconsistent indentation for list items at the same level * **[MD005](doc/Rules.md#md005)** *list-indent* - Inconsistent indentation for list items at the same level
@ -76,7 +76,7 @@ playground for learning and exploring.
* **[MD022](doc/Rules.md#md022)** *blanks-around-headings/blanks-around-headers* - Headings should be surrounded by blank lines * **[MD022](doc/Rules.md#md022)** *blanks-around-headings/blanks-around-headers* - Headings should be surrounded by blank lines
* **[MD023](doc/Rules.md#md023)** *heading-start-left/header-start-left* - Headings must start at the beginning of the line * **[MD023](doc/Rules.md#md023)** *heading-start-left/header-start-left* - Headings must start at the beginning of the line
* **[MD024](doc/Rules.md#md024)** *no-duplicate-heading/no-duplicate-header* - Multiple headings with the same content * **[MD024](doc/Rules.md#md024)** *no-duplicate-heading/no-duplicate-header* - Multiple headings with the same content
* **[MD025](doc/Rules.md#md025)** *single-title/single-h1* - Multiple top level headings in the same document * **[MD025](doc/Rules.md#md025)** *single-title/single-h1* - Multiple top-level headings in the same document
* **[MD026](doc/Rules.md#md026)** *no-trailing-punctuation* - Trailing punctuation in heading * **[MD026](doc/Rules.md#md026)** *no-trailing-punctuation* - Trailing punctuation in heading
* **[MD027](doc/Rules.md#md027)** *no-multiple-space-blockquote* - Multiple spaces after blockquote symbol * **[MD027](doc/Rules.md#md027)** *no-multiple-space-blockquote* - Multiple spaces after blockquote symbol
* **[MD028](doc/Rules.md#md028)** *no-blanks-blockquote* - Blank line inside blockquote * **[MD028](doc/Rules.md#md028)** *no-blanks-blockquote* - Blank line inside blockquote
@ -92,7 +92,7 @@ playground for learning and exploring.
* **[MD038](doc/Rules.md#md038)** *no-space-in-code* - Spaces inside code span elements * **[MD038](doc/Rules.md#md038)** *no-space-in-code* - Spaces inside code span elements
* **[MD039](doc/Rules.md#md039)** *no-space-in-links* - Spaces inside link text * **[MD039](doc/Rules.md#md039)** *no-space-in-links* - Spaces inside link text
* **[MD040](doc/Rules.md#md040)** *fenced-code-language* - Fenced code blocks should have a language specified * **[MD040](doc/Rules.md#md040)** *fenced-code-language* - Fenced code blocks should have a language specified
* **[MD041](doc/Rules.md#md041)** *first-line-heading/first-line-h1* - First line in file should be a top level heading * **[MD041](doc/Rules.md#md041)** *first-line-heading/first-line-h1* - First line in a file should be a top-level heading
* **[MD042](doc/Rules.md#md042)** *no-empty-links* - No empty links * **[MD042](doc/Rules.md#md042)** *no-empty-links* - No empty links
* **[MD043](doc/Rules.md#md043)** *required-headings/required-headers* - Required heading structure * **[MD043](doc/Rules.md#md043)** *required-headings/required-headers* - Required heading structure
* **[MD044](doc/Rules.md#md044)** *proper-names* - Proper names should have the correct capitalization * **[MD044](doc/Rules.md#md044)** *proper-names* - Proper names should have the correct capitalization
@ -650,11 +650,11 @@ Output:
bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19] bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19]
bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.string"] bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.string"]
bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."] bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."]
bad.string: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.string"] bad.string: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.string"]
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17] bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"] bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."] bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"] bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
``` ```
Or invoke `markdownlint.sync` for a synchronous call: Or invoke `markdownlint.sync` for a synchronous call:
@ -703,7 +703,7 @@ Output:
"errorRange": [ 1, 2 ] }, "errorRange": [ 1, 2 ] },
{ "lineNumber": 1, { "lineNumber": 1,
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
"ruleDescription": "First line in file should be a top level heading", "ruleDescription": "First line in a file should be a top-level heading",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041",
"errorDetail": null, "errorDetail": null,
"errorContext": "#bad.md", "errorContext": "#bad.md",
@ -742,7 +742,7 @@ Output:
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17] bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"] bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."] bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"] bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
[00:00:00] Finished 'markdownlint' after 10 ms [00:00:00] Finished 'markdownlint' after 10 ms
``` ```
@ -783,7 +783,7 @@ Warning:
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17] bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"] bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."] bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"] bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
Use --force to continue. Use --force to continue.
``` ```

View file

@ -1689,7 +1689,7 @@ module.exports = {
var addErrorDetailIf = require("../helpers").addErrorDetailIf; var addErrorDetailIf = require("../helpers").addErrorDetailIf;
module.exports = { module.exports = {
"names": ["MD002", "first-heading-h1", "first-header-h1"], "names": ["MD002", "first-heading-h1", "first-header-h1"],
"description": "First heading should be a top level heading", "description": "First heading should be a top-level heading",
"tags": ["headings", "headers"], "tags": ["headings", "headers"],
"function": function MD002(params, onError) { "function": function MD002(params, onError) {
var level = Number(params.config.level || 1); var level = Number(params.config.level || 1);
@ -2420,7 +2420,7 @@ module.exports = {
var _a = require("../helpers"), addErrorContext = _a.addErrorContext, filterTokens = _a.filterTokens, frontMatterHasTitle = _a.frontMatterHasTitle; var _a = require("../helpers"), addErrorContext = _a.addErrorContext, filterTokens = _a.filterTokens, frontMatterHasTitle = _a.frontMatterHasTitle;
module.exports = { module.exports = {
"names": ["MD025", "single-title", "single-h1"], "names": ["MD025", "single-title", "single-h1"],
"description": "Multiple top level headings in the same document", "description": "Multiple top-level headings in the same document",
"tags": ["headings", "headers"], "tags": ["headings", "headers"],
"function": function MD025(params, onError) { "function": function MD025(params, onError) {
var level = Number(params.config.level || 1); var level = Number(params.config.level || 1);
@ -3159,7 +3159,7 @@ module.exports = {
var _a = require("../helpers"), addErrorContext = _a.addErrorContext, frontMatterHasTitle = _a.frontMatterHasTitle; var _a = require("../helpers"), addErrorContext = _a.addErrorContext, frontMatterHasTitle = _a.frontMatterHasTitle;
module.exports = { module.exports = {
"names": ["MD041", "first-line-heading", "first-line-h1"], "names": ["MD041", "first-line-heading", "first-line-h1"],
"description": "First line in file should be a top level heading", "description": "First line in a file should be a top-level heading",
"tags": ["headings", "headers"], "tags": ["headings", "headers"],
"function": function MD041(params, onError) { "function": function MD041(params, onError) {
var level = Number(params.config.level || 1); var level = Number(params.config.level || 1);

View file

@ -1,7 +1,7 @@
# Rules # Rules
This document contains a description of all rules, what they are checking for, 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 as well as examples of documents that break the rule and corrected
versions of the examples. Any rule whose heading is ~~struck through~~ is versions of the examples. Any rule whose heading is ~~struck through~~ is
deprecated, but still provided for backward-compatibility. deprecated, but still provided for backward-compatibility.
@ -47,7 +47,7 @@ when skipped - especially for accessibility scenarios. More information:
<a name="md002"></a> <a name="md002"></a>
## ~~MD002 - First heading should be a top level heading~~ ## ~~MD002 - First heading should be a top-level heading~~
Tags: headings, headers Tags: headings, headers
@ -59,26 +59,26 @@ Parameters: level (number; default 1)
> [MD041/first-line-heading](#md041) offers an improved implementation. > [MD041/first-line-heading](#md041) offers an improved implementation.
This rule is intended to ensure document headings start at the top level and This rule is intended to ensure document headings start at the top level and
is triggered when the first heading in the document isn't a h1 heading: is triggered when the first heading in the document isn't an h1 heading:
```markdown ```markdown
## This isn't a H1 heading ## This isn't an H1 heading
### Another heading ### Another heading
``` ```
The first heading in the document should be a h1 heading: The first heading in the document should be an h1 heading:
```markdown ```markdown
# Start with a H1 heading # Start with an H1 heading
## Then use an H2 for subsections ## Then use an H2 for subsections
``` ```
Note: The `level` parameter can be used to change the top level (ex: to h2) in Note: The `level` parameter can be used to change the top-level (ex: to h2) in
cases where a h1 is added externally. cases where an h1 is added externally.
Rationale: The top level heading often acts as the title of a document. More Rationale: The top-level heading often acts as the title of a document. More
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>. information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
<a name="md003"></a> <a name="md003"></a>
@ -127,7 +127,7 @@ Setext style H2
Note: the configured heading style can be a specific style to use (atx, Note: the configured heading style can be a specific style to use (atx,
atx_closed, setext, setext_with_atx, setext_with_atx_closed), or simply require atx_closed, setext, setext_with_atx, setext_with_atx_closed), or simply require
that the usage be consistent within the document. that the usage is consistent within the document.
Rationale: Consistent formatting makes it easier to understand a document. Rationale: Consistent formatting makes it easier to understand a document.
@ -161,8 +161,8 @@ document:
``` ```
The configured list style can be a specific symbol to use (asterisk, plus, dash), 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 to ensure that all list styling is consistent, or to ensure that each
sublist have a consistent symbol that is different from its parent list. sublist has a consistent symbol that differs from its parent list.
For example, the following is valid for the `sublist` style because the outer-most 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: indent uses asterisk, the middle indent uses plus, and the inner-most indent uses dash:
@ -198,7 +198,7 @@ but don't have the same indentation:
* A misaligned item * A misaligned item
``` ```
Usually this rule will be triggered because of a typo. Correct the indentation Usually, this rule will be triggered because of a typo. Correct the indentation
for the list to fix it: for the list to fix it:
```markdown ```markdown
@ -244,7 +244,7 @@ Aliases: ul-start-left
Fixable: Most violations can be fixed by tooling Fixable: Most violations can be fixed by tooling
This rule is triggered when top level lists don't start at the beginning of a This rule is triggered when top-level lists don't start at the beginning of a
line: line:
```markdown ```markdown
@ -254,7 +254,7 @@ Some text
* List item * List item
``` ```
To fix, ensure that top level list items are not indented: To fix, ensure that top-level list items are not indented:
```markdown ```markdown
Some test Some test
@ -322,7 +322,7 @@ Rationale: 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 line with the start of the content of the parent list when a single space is
used after the list marker. Indenting by 4 spaces is consistent with code blocks used after the list marker. Indenting by 4 spaces is consistent with code blocks
and simpler for editors to implement. Additionally, this can be a compatibility and simpler for editors to implement. Additionally, this can be a compatibility
issue for multi-markdown parsers, which require a 4-space indents. More information: issue for multi-markdown parsers, which require 4-space indents. More information:
<https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists> <https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>. and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
@ -526,7 +526,7 @@ This-line-is-also-okay-because-there-are-no-spaces
``` ```
In `strict` or `stern` modes, the two middle lines above are a violation. The In `strict` or `stern` modes, the two middle lines above are a violation. The
third line is a violation in `strict` mode, but allowed in `stern` mode. third line is a violation in `strict` mode but allowed in `stern` mode.
You have the option to exclude this rule for code blocks, tables, or headings. 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. To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
@ -764,7 +764,7 @@ number of blank lines (including 0) above or below each heading.
Note: If `lines_above` or `lines_below` are configured to require more than one Note: If `lines_above` or `lines_below` are configured to require more than one
blank line, [MD012/no-multiple-blanks](#md012) should also be customized. blank line, [MD012/no-multiple-blanks](#md012) should also be customized.
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`, will
not parse headings that don't have a blank line before, and will parse them as not parse headings that don't have a blank line before, and will parse them as
regular text. regular text.
@ -845,7 +845,7 @@ heading name; headings with the same content can cause problems with that.
<a name="md025"></a> <a name="md025"></a>
## MD025 - Multiple top level headings in the same document ## MD025 - Multiple top-level headings in the same document
Tags: headings, headers Tags: headings, headers
@ -853,19 +853,19 @@ Aliases: single-title, single-h1
Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]") Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
This rule is triggered when a top level heading is in use (the first line of 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 the file is an h1 heading), and more than one h1 heading is in use in the
document: document:
```markdown ```markdown
# Top level heading # Top level heading
# Another top level heading # Another top-level heading
``` ```
To fix, structure your document so that there is a single h1 heading that is To fix, structure your document so there is a single h1 heading that is
the title for the document, and all later headings are h2 or lower level the title for the document. Subsequent headings must be
headings: lower-level headings (h2, h3, etc.):
```markdown ```markdown
# Title # Title
@ -875,17 +875,17 @@ headings:
## Another heading ## Another heading
``` ```
Note: The `level` parameter can be used to change the top level (ex: to h2) in Note: The `level` parameter can be used to change the top-level (ex: to h2) in
cases where a h1 is added externally. cases where an h1 is added externally.
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains
a `title` property (commonly used with blog posts), this rule treats that as a top a `title` property (commonly used with blog posts), this rule treats that as a top
level heading and will report a violation for any subsequent top level headings. level heading and will report a violation for any subsequent top-level headings.
To use a different property name in front matter, specify the text of a regular To use a different property name in the front matter, specify the text of a regular
expression via the `front_matter_title` parameter. To disable the use of front expression via the `front_matter_title` parameter. To disable the use of front
matter by this rule, specify `""` for `front_matter_title`. matter by this rule, specify `""` for `front_matter_title`.
Rationale: A top level heading is a h1 on the first line of the file, and Rationale: A top-level heading is an h1 on the first line of the file, and
serves as the title for the document. If this convention is in use, then there 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 can not be more than one title for the document, and the entire document
should be contained within this heading. should be contained within this heading.
@ -917,7 +917,7 @@ To fix this, remove the trailing punctuation:
Note: The `punctuation` parameter can be used to specify what characters count Note: The `punctuation` parameter can be used to specify what characters count
as punctuation at the end of a heading. For example, you can change it to as punctuation at the end of a heading. For example, you can change it to
`".,;:"` to allow headings that end with an exclamation point. Question mark is `".,;:"` to allow headings that end with an exclamation point. Question marks is
allowed by default because of how common it is in headings of FAQ-style documents. allowed by default because of how common it is in headings of FAQ-style documents.
Setting the `punctuation` parameter to `""` allows all characters - and is Setting the `punctuation` parameter to `""` allows all characters - and is
equivalent to disabling the rule. equivalent to disabling the rule.
@ -1011,7 +1011,7 @@ Parameters: style ("one", "ordered", "one_or_ordered", "zero"; default "one_or_o
This rule is triggered for ordered lists that do not either start with '1.' or This rule is triggered for ordered lists that do not either start with '1.' or
do not have a prefix that increases in numerical order (depending on the do not have a prefix that increases in numerical order (depending on the
configured style). The less-common patterns of using '0.' as a first prefix or configured style). The less-common pattern of using '0.' as a first prefix or
for all prefixes is also supported. for all prefixes is also supported.
Example valid list if the style is configured as 'one': Example valid list if the style is configured as 'one':
@ -1129,7 +1129,7 @@ default is 1 space after any list marker:
A document style may change the number of spaces after unordered list items 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 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 of every item in the list consists of a single paragraph or multiple
paragraphs (including sub-lists and code blocks). paragraphs (including sub-lists and code blocks).
For example, the style guide at For example, the style guide at
@ -1165,7 +1165,7 @@ or
1. Bar 1. Bar
``` ```
To fix this, ensure the correct number of spaces are used after list marker To fix this, ensure the correct number of spaces are used after the list marker
for your selected document style. for your selected document style.
Rationale: Violations of this rule can lead to improperly rendered content. Rationale: Violations of this rule can lead to improperly rendered content.
@ -1373,7 +1373,7 @@ or match the given style if the rule is so configured:
``` ```
Note: by default, this rule is configured to just require that all horizontal 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 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 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 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 the 'style' option is a string containing the exact horizontal rule text that
@ -1417,7 +1417,7 @@ Lorem ipsum dolor sit amet...
Consectetur adipiscing elit, sed do eiusmod. Consectetur adipiscing elit, sed do eiusmod.
``` ```
Note: This rule looks for single line paragraphs that consist entirely Note: This rule looks for single-line paragraphs that consist entirely
of emphasized text. It won't fire on emphasis used within regular text, of emphasized text. It won't fire on emphasis used within regular text,
multi-line emphasized paragraphs, or paragraphs ending in punctuation multi-line emphasized paragraphs, or paragraphs ending in punctuation
(normal or full-width). Similarly to rule MD026, you can configure what (normal or full-width). Similarly to rule MD026, you can configure what
@ -1463,7 +1463,7 @@ Here is some more _italic_ text.
``` ```
Rationale: Emphasis is only parsed as such when the asterisks/underscores Rationale: Emphasis is only parsed as such when the asterisks/underscores
aren't completely surrounded by spaces. This rule attempts to detect where aren't surrounded by spaces. This rule attempts to detect where
they were surrounded by spaces, but it appears that emphasized text was they were surrounded by spaces, but it appears that emphasized text was
intended by the author. intended by the author.
@ -1565,7 +1565,7 @@ correct syntax highlighting for code. More information:
<a name="md041"></a> <a name="md041"></a>
## MD041 - First line in file should be a top level heading ## MD041 - First line in a file should be a top-level heading
Tags: headings, headers Tags: headings, headers
@ -1574,30 +1574,30 @@ Aliases: first-line-heading, first-line-h1
Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]") Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
This rule is intended to ensure documents have a title and is triggered when This rule is intended to ensure documents have a title and is triggered when
the first line in the file isn't a top level (h1) heading: the first line in the file isn't a top-level (h1) heading:
```markdown ```markdown
This is a file without a heading This is a file without a heading
``` ```
To fix this, add a top level heading to the beginning of the file: To fix this, add a top-level heading to the beginning of the file:
```markdown ```markdown
# File with heading # File with heading
This is a file with a top level heading This is a file with a top-level heading
``` ```
Note: The `level` parameter can be used to change the top level (ex: to h2) in cases Note: The `level` parameter can be used to change the top-level (ex: to h2) in cases
where a h1 is added externally. where an h1 is added externally.
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains a If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains a
`title` property (commonly used with blog posts), this rule will not report a `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 violation. To use a different property name in the front matter, specify the text
of a regular expression via the `front_matter_title` parameter. To disable the 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`. use of front matter by this rule, specify `""` for `front_matter_title`.
Rationale: The top level heading often acts as the title of a document. More Rationale: The top-level heading often acts as the title of a document. More
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>. information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
<a name="md042"></a> <a name="md042"></a>
@ -1814,7 +1814,7 @@ Fixable: Most violations can be fixed by tooling
This rule is triggered when there is not a single newline character at the end of a file. This rule is triggered when there is not a single newline character at the end of a file.
Example that triggers the rule: An example that triggers the rule:
```markdown ```markdown
# Heading # Heading

View file

@ -6,7 +6,7 @@ const { addErrorDetailIf } = require("../helpers");
module.exports = { module.exports = {
"names": [ "MD002", "first-heading-h1", "first-header-h1" ], "names": [ "MD002", "first-heading-h1", "first-header-h1" ],
"description": "First heading should be a top level heading", "description": "First heading should be a top-level heading",
"tags": [ "headings", "headers" ], "tags": [ "headings", "headers" ],
"function": function MD002(params, onError) { "function": function MD002(params, onError) {
const level = Number(params.config.level || 1); const level = Number(params.config.level || 1);

View file

@ -7,7 +7,7 @@ const { addErrorContext, filterTokens, frontMatterHasTitle } =
module.exports = { module.exports = {
"names": [ "MD025", "single-title", "single-h1" ], "names": [ "MD025", "single-title", "single-h1" ],
"description": "Multiple top level headings in the same document", "description": "Multiple top-level headings in the same document",
"tags": [ "headings", "headers" ], "tags": [ "headings", "headers" ],
"function": function MD025(params, onError) { "function": function MD025(params, onError) {
const level = Number(params.config.level || 1); const level = Number(params.config.level || 1);

View file

@ -6,7 +6,7 @@ const { addErrorContext, frontMatterHasTitle } = require("../helpers");
module.exports = { module.exports = {
"names": [ "MD041", "first-line-heading", "first-line-h1" ], "names": [ "MD041", "first-line-heading", "first-line-h1" ],
"description": "First line in file should be a top level heading", "description": "First line in a file should be a top-level heading",
"tags": [ "headings", "headers" ], "tags": [ "headings", "headers" ],
"function": function MD041(params, onError) { "function": function MD041(params, onError) {
const level = Number(params.config.level || 1); const level = Number(params.config.level || 1);

View file

@ -33,7 +33,7 @@
"default": true "default": true
}, },
"MD002": { "MD002": {
"description": "MD002/first-heading-h1/first-header-h1 - First heading should be a top level heading", "description": "MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -49,7 +49,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"first-heading-h1": { "first-heading-h1": {
"description": "MD002/first-heading-h1/first-header-h1 - First heading should be a top level heading", "description": "MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -65,7 +65,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"first-header-h1": { "first-header-h1": {
"description": "MD002/first-heading-h1/first-header-h1 - First heading should be a top level heading", "description": "MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -690,7 +690,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"MD025": { "MD025": {
"description": "MD025/single-title/single-h1 - Multiple top level headings in the same document", "description": "MD025/single-title/single-h1 - Multiple top-level headings in the same document",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -711,7 +711,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"single-title": { "single-title": {
"description": "MD025/single-title/single-h1 - Multiple top level headings in the same document", "description": "MD025/single-title/single-h1 - Multiple top-level headings in the same document",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -732,7 +732,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"single-h1": { "single-h1": {
"description": "MD025/single-title/single-h1 - Multiple top level headings in the same document", "description": "MD025/single-title/single-h1 - Multiple top-level headings in the same document",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -1121,7 +1121,7 @@
"default": true "default": true
}, },
"MD041": { "MD041": {
"description": "MD041/first-line-heading/first-line-h1 - First line in file should be a top level heading", "description": "MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -1142,7 +1142,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"first-line-heading": { "first-line-heading": {
"description": "MD041/first-line-heading/first-line-h1 - First line in file should be a top level heading", "description": "MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading",
"type": [ "type": [
"boolean", "boolean",
"object" "object"
@ -1163,7 +1163,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"first-line-h1": { "first-line-h1": {
"description": "MD041/first-line-heading/first-line-h1 - First line in file should be a top level heading", "description": "MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading",
"type": [ "type": [
"boolean", "boolean",
"object" "object"

View file

@ -11,7 +11,7 @@
{ {
"lineNumber": 1, "lineNumber": 1,
"ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ], "ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ],
"ruleDescription": "First heading should be a top level heading", "ruleDescription": "First heading should be a top-level heading",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md002", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md002",
"errorDetail": "Expected: h1; Actual: h2", "errorDetail": "Expected: h1; Actual: h2",
"errorContext": null, "errorContext": null,

View file

@ -29,7 +29,7 @@
{ {
"lineNumber": 4, "lineNumber": 4,
"ruleNames": [ "MD025", "single-title", "single-h1" ], "ruleNames": [ "MD025", "single-title", "single-h1" ],
"ruleDescription": "Multiple top level headings in the same document", "ruleDescription": "Multiple top-level headings in the same document",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md025", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md025",
"errorDetail": null, "errorDetail": null,
"errorContext": "# Heading", "errorContext": "# Heading",

View file

@ -2,7 +2,7 @@
{ {
"lineNumber": 1, "lineNumber": 1,
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
"ruleDescription": "First line in file should be a top level heading", "ruleDescription": "First line in a file should be a top-level heading",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041",
"errorDetail": null, "errorDetail": null,
"errorContext": "Not a heading", "errorContext": "Not a heading",

View file

@ -11,7 +11,7 @@
{ {
"lineNumber": 4, "lineNumber": 4,
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
"ruleDescription": "First line in file should be a top level heading", "ruleDescription": "First line in a file should be a top-level heading",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041",
"errorDetail": null, "errorDetail": null,
"errorContext": "Text", "errorContext": "Text",

View file

@ -974,7 +974,7 @@ tape("customRulesThrowForStringHandled", (test) => {
"lineNumber": 1, "lineNumber": 1,
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
"ruleDescription": "ruleDescription":
"First line in file should be a top level heading", "First line in a file should be a top-level heading",
"ruleInformation": "ruleInformation":
`${homepage}/blob/v${version}/doc/Rules.md#md041`, `${homepage}/blob/v${version}/doc/Rules.md#md041`,
"errorDetail": null, "errorDetail": null,

View file

@ -55,7 +55,7 @@ tape("resultFormattingV0", (test) => {
let actualMessage = actualResult.toString(); let actualMessage = actualResult.toString();
let expectedMessage = let expectedMessage =
"./test/atx_heading_spacing.md: 3: MD002" + "./test/atx_heading_spacing.md: 3: MD002" +
" First heading should be a top level heading\n" + " First heading should be a top-level heading\n" +
"./test/atx_heading_spacing.md: 1: MD018" + "./test/atx_heading_spacing.md: 1: MD018" +
" No space after hash on atx style heading\n" + " No space after hash on atx style heading\n" +
"./test/atx_heading_spacing.md: 3: MD019" + "./test/atx_heading_spacing.md: 3: MD019" +
@ -63,13 +63,13 @@ tape("resultFormattingV0", (test) => {
"./test/atx_heading_spacing.md: 5: MD019" + "./test/atx_heading_spacing.md: 5: MD019" +
" Multiple spaces after hash on atx style heading\n" + " Multiple spaces after hash on atx style heading\n" +
"./test/first_heading_bad_atx.md: 1: MD002" + "./test/first_heading_bad_atx.md: 1: MD002" +
" First heading should be a top level heading"; " First heading should be a top-level heading";
test.equal(actualMessage, expectedMessage, "Incorrect message (name)."); test.equal(actualMessage, expectedMessage, "Incorrect message (name).");
// @ts-ignore // @ts-ignore
actualMessage = actualResult.toString(true); actualMessage = actualResult.toString(true);
expectedMessage = expectedMessage =
"./test/atx_heading_spacing.md: 3: first-heading-h1" + "./test/atx_heading_spacing.md: 3: first-heading-h1" +
" First heading should be a top level heading\n" + " First heading should be a top-level heading\n" +
"./test/atx_heading_spacing.md: 1: no-missing-space-atx" + "./test/atx_heading_spacing.md: 1: no-missing-space-atx" +
" No space after hash on atx style heading\n" + " No space after hash on atx style heading\n" +
"./test/atx_heading_spacing.md: 3: no-multiple-space-atx" + "./test/atx_heading_spacing.md: 3: no-multiple-space-atx" +
@ -77,7 +77,7 @@ tape("resultFormattingV0", (test) => {
"./test/atx_heading_spacing.md: 5: no-multiple-space-atx" + "./test/atx_heading_spacing.md: 5: no-multiple-space-atx" +
" Multiple spaces after hash on atx style heading\n" + " Multiple spaces after hash on atx style heading\n" +
"./test/first_heading_bad_atx.md: 1: first-heading-h1" + "./test/first_heading_bad_atx.md: 1: first-heading-h1" +
" First heading should be a top level heading"; " First heading should be a top-level heading";
test.equal(actualMessage, expectedMessage, "Incorrect message (alias)."); test.equal(actualMessage, expectedMessage, "Incorrect message (alias).");
test.end(); test.end();
}); });
@ -111,7 +111,7 @@ tape("resultFormattingSyncV0", (test) => {
let actualMessage = actualResult.toString(); let actualMessage = actualResult.toString();
let expectedMessage = let expectedMessage =
"./test/atx_heading_spacing.md: 3: MD002" + "./test/atx_heading_spacing.md: 3: MD002" +
" First heading should be a top level heading\n" + " First heading should be a top-level heading\n" +
"./test/atx_heading_spacing.md: 1: MD018" + "./test/atx_heading_spacing.md: 1: MD018" +
" No space after hash on atx style heading\n" + " No space after hash on atx style heading\n" +
"./test/atx_heading_spacing.md: 3: MD019" + "./test/atx_heading_spacing.md: 3: MD019" +
@ -119,13 +119,13 @@ tape("resultFormattingSyncV0", (test) => {
"./test/atx_heading_spacing.md: 5: MD019" + "./test/atx_heading_spacing.md: 5: MD019" +
" Multiple spaces after hash on atx style heading\n" + " Multiple spaces after hash on atx style heading\n" +
"./test/first_heading_bad_atx.md: 1: MD002" + "./test/first_heading_bad_atx.md: 1: MD002" +
" First heading should be a top level heading"; " First heading should be a top-level heading";
test.equal(actualMessage, expectedMessage, "Incorrect message (name)."); test.equal(actualMessage, expectedMessage, "Incorrect message (name).");
// @ts-ignore // @ts-ignore
actualMessage = actualResult.toString(true); actualMessage = actualResult.toString(true);
expectedMessage = expectedMessage =
"./test/atx_heading_spacing.md: 3: first-heading-h1" + "./test/atx_heading_spacing.md: 3: first-heading-h1" +
" First heading should be a top level heading\n" + " First heading should be a top-level heading\n" +
"./test/atx_heading_spacing.md: 1: no-missing-space-atx" + "./test/atx_heading_spacing.md: 1: no-missing-space-atx" +
" No space after hash on atx style heading\n" + " No space after hash on atx style heading\n" +
"./test/atx_heading_spacing.md: 3: no-multiple-space-atx" + "./test/atx_heading_spacing.md: 3: no-multiple-space-atx" +
@ -133,7 +133,7 @@ tape("resultFormattingSyncV0", (test) => {
"./test/atx_heading_spacing.md: 5: no-multiple-space-atx" + "./test/atx_heading_spacing.md: 5: no-multiple-space-atx" +
" Multiple spaces after hash on atx style heading\n" + " Multiple spaces after hash on atx style heading\n" +
"./test/first_heading_bad_atx.md: 1: first-heading-h1" + "./test/first_heading_bad_atx.md: 1: first-heading-h1" +
" First heading should be a top level heading"; " First heading should be a top-level heading";
test.equal(actualMessage, expectedMessage, "Incorrect message (alias)."); test.equal(actualMessage, expectedMessage, "Incorrect message (alias).");
test.end(); test.end();
}); });
@ -173,7 +173,7 @@ tape("resultFormattingV1", (test) => {
{ "lineNumber": 3, { "lineNumber": 3,
"ruleName": "MD002", "ruleName": "MD002",
"ruleAlias": "first-heading-h1", "ruleAlias": "first-heading-h1",
"ruleDescription": "First heading should be a top level heading", "ruleDescription": "First heading should be a top-level heading",
"ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`, "ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`,
"errorDetail": "Expected: h1; Actual: h2", "errorDetail": "Expected: h1; Actual: h2",
"errorContext": null, "errorContext": null,
@ -207,7 +207,7 @@ tape("resultFormattingV1", (test) => {
{ "lineNumber": 1, { "lineNumber": 1,
"ruleName": "MD002", "ruleName": "MD002",
"ruleAlias": "first-heading-h1", "ruleAlias": "first-heading-h1",
"ruleDescription": "First heading should be a top level heading", "ruleDescription": "First heading should be a top-level heading",
"ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`, "ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`,
"errorDetail": "Expected: h1; Actual: h2", "errorDetail": "Expected: h1; Actual: h2",
"errorContext": null, "errorContext": null,
@ -218,7 +218,7 @@ tape("resultFormattingV1", (test) => {
const actualMessage = actualResult.toString(); const actualMessage = actualResult.toString();
const expectedMessage = const expectedMessage =
"./test/atx_heading_spacing.md: 3: MD002/first-heading-h1" + "./test/atx_heading_spacing.md: 3: MD002/first-heading-h1" +
" First heading should be a top level heading" + " First heading should be a top-level heading" +
" [Expected: h1; Actual: h2]\n" + " [Expected: h1; Actual: h2]\n" +
"./test/atx_heading_spacing.md: 1: MD018/no-missing-space-atx" + "./test/atx_heading_spacing.md: 1: MD018/no-missing-space-atx" +
" No space after hash on atx style heading" + " No space after hash on atx style heading" +
@ -230,7 +230,7 @@ tape("resultFormattingV1", (test) => {
" Multiple spaces after hash on atx style heading" + " Multiple spaces after hash on atx style heading" +
" [Context: \"## Heading 3 {MD019}\"]\n" + " [Context: \"## Heading 3 {MD019}\"]\n" +
"./test/first_heading_bad_atx.md: 1: MD002/first-heading-h1" + "./test/first_heading_bad_atx.md: 1: MD002/first-heading-h1" +
" First heading should be a top level heading" + " First heading should be a top-level heading" +
" [Expected: h1; Actual: h2]\n" + " [Expected: h1; Actual: h2]\n" +
"truncate: 1: MD021/no-multiple-space-closed-atx" + "truncate: 1: MD021/no-multiple-space-closed-atx" +
" Multiple spaces inside hashes on closed atx style heading" + " Multiple spaces inside hashes on closed atx style heading" +
@ -272,7 +272,7 @@ tape("resultFormattingV2", (test) => {
"./test/atx_heading_spacing.md": [ "./test/atx_heading_spacing.md": [
{ "lineNumber": 3, { "lineNumber": 3,
"ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ], "ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ],
"ruleDescription": "First heading should be a top level heading", "ruleDescription": "First heading should be a top-level heading",
"ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`, "ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`,
"errorDetail": "Expected: h1; Actual: h2", "errorDetail": "Expected: h1; Actual: h2",
"errorContext": null, "errorContext": null,
@ -302,7 +302,7 @@ tape("resultFormattingV2", (test) => {
"./test/first_heading_bad_atx.md": [ "./test/first_heading_bad_atx.md": [
{ "lineNumber": 1, { "lineNumber": 1,
"ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ], "ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ],
"ruleDescription": "First heading should be a top level heading", "ruleDescription": "First heading should be a top-level heading",
"ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`, "ruleInformation": `${homepage}/blob/v${version}/doc/Rules.md#md002`,
"errorDetail": "Expected: h1; Actual: h2", "errorDetail": "Expected: h1; Actual: h2",
"errorContext": null, "errorContext": null,
@ -314,7 +314,7 @@ tape("resultFormattingV2", (test) => {
const expectedMessage = const expectedMessage =
"./test/atx_heading_spacing.md: 3:" + "./test/atx_heading_spacing.md: 3:" +
" MD002/first-heading-h1/first-header-h1" + " MD002/first-heading-h1/first-header-h1" +
" First heading should be a top level heading" + " First heading should be a top-level heading" +
" [Expected: h1; Actual: h2]\n" + " [Expected: h1; Actual: h2]\n" +
"./test/atx_heading_spacing.md: 1: MD018/no-missing-space-atx" + "./test/atx_heading_spacing.md: 1: MD018/no-missing-space-atx" +
" No space after hash on atx style heading" + " No space after hash on atx style heading" +
@ -327,7 +327,7 @@ tape("resultFormattingV2", (test) => {
" [Context: \"## Heading 3 {MD019}\"]\n" + " [Context: \"## Heading 3 {MD019}\"]\n" +
"./test/first_heading_bad_atx.md: 1:" + "./test/first_heading_bad_atx.md: 1:" +
" MD002/first-heading-h1/first-header-h1" + " MD002/first-heading-h1/first-header-h1" +
" First heading should be a top level heading" + " First heading should be a top-level heading" +
" [Expected: h1; Actual: h2]\n" + " [Expected: h1; Actual: h2]\n" +
"truncate: 1: MD021/no-multiple-space-closed-atx" + "truncate: 1: MD021/no-multiple-space-closed-atx" +
" Multiple spaces inside hashes on closed atx style heading" + " Multiple spaces inside hashes on closed atx style heading" +