You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-17Lines changed: 26 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,13 @@
1
1
# GitHub Flavored Markdown Linting
2
2
3
-
We are using the [`markdownlint`](https://github.com/DavidAnson/markdownlint) library (via [`markdownlint-cli2`](https://github.com/DavidAnson/markdownlint-cli2) and adding our opinions and custom rules to it.
4
3
5
-
To review behaviors supported by `markdownlint`, particularly how to enable or disable rules, see [`markdownlint-cli2` configuration](https://github.com/DavidAnson/markdownlint-cli2#configuration).
4
+
This repository provides GitHub's recommended [`markdownlint`](https://github.com/DavidAnson/markdownlint) configurations, and additional rules for use on GitHub open source and internal projects.
6
5
7
6
## Opinions
8
7
9
-
At GitHub, we have opinions about how our markdown should be written.
10
-
11
8
In addition to defaults defined by `markdownlint`, we use this repository to enforce rules not defined by default, including our own custom rules.
12
9
13
-
See our opinions codified in [index.js](./index.js).
14
-
15
-
### Should I disable rules enabled by this plugin?
16
-
17
-
This plugin will enable the defaults defined by `markdownlint`. Several of these pertain to stylistic practices. You may choose to disable these rules if you determine it doesn't provide value for your project.
18
-
19
-
However, others of these rules should **NOT** be disabled because they encourage best accessibility practices. Disabling these rules will negatively impact accessibility. These rules are specified in [accessibility.json](./accessibility.json).
10
+
See opinions codified in [index.js](./index.js).
20
11
21
12
## Rules
22
13
@@ -29,19 +20,20 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali
29
20
30
21
## Usage
31
22
32
-
**Note**: We recommend configuring [`markdownlint-cli2`](https://github.com/DavidAnson/markdownlint-cli2)over `markdownlint-cli` for compatibility with the [vscode-markdownlint](https://github.com/DavidAnson/vscode-markdownlint) plugin.
23
+
**Important**: We support the use of `markdownlint` through [`markdownlint-cli2`](https://github.com/DavidAnson/markdownlint-cli2)instead of `markdownlint-cli` for compatability with the [`vscode-markdownlint`](https://github.com/DavidAnson/vscode-markdownlint) plugin.
33
24
34
-
1. Create a `.markdownlint-cli2.cjs` file in the root of your repository
25
+
1. Create a `.markdownlint-cli2.cjs` file in the root of your repository.
35
26
36
27
```bash
37
28
touch .markdownlint-cli2.cjs
38
29
```
39
30
40
-
2. Install packages
31
+
2. Install packages.
41
32
42
33
- ```bash
43
34
npm install -D markdownlint-cli2 # if updating existing package, check for updates
3. Add/modify your linting script in`package.json`.
@@ -57,22 +49,39 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali
57
49
module.exports = {
58
50
config: options,
59
51
customRules: ["@github/markdownlint-github"],
52
+
outputFormatters: [
53
+
[ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] // ensures the error message includes a link to the rule documentation
54
+
]
60
55
}
61
56
```
62
57
63
-
Or, you can also pass in configuration options that you wish to override the default. This looks like:
58
+
Or, you can also pass in configuration options that you wish to override the default. Read more at [Customizing configurations](#customizing-configurations).
5. Install the [`vscode-markdownlint`](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) plugin to ensure `markdownlint` violations are surfaced in the file. This plugin should flag rules based off your `.markdownlint-cli2.cjs` configuration. When you make edits to your configuartion, you will need to reload the VSCode window (`Ctrl+Shift+P` ->`Reload Window`) to ensure the extension syncs.
74
+
5. Install the [`vscode-markdownlint`](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) plugin to ensure `markdownlint` violations are surfaced in the file. This plugin should flag rules based off your `.markdownlint-cli2.cjs` configuration. When you make edits to your configuration, you will need to reload the VSCode window (`Ctrl+Shift+P` ->`Reload Window`) to ensure the extension syncs. If your project runs on Codespaces, consider adding this extension to your `.devcontainer/devcontainer.json` so that this extension is installed to new Codespaces by default.
75
+
76
+
### Customizing configurations
77
+
78
+
You may determine that the defaults set by this plugin are not suitable for your project.
79
+
80
+
This plugin will pull in the the defaults defined by `markdownlint`, several of which pertain to stylistic practices. You may choose to disable these rules if you determine it doesn't provide value for your project.
81
+
82
+
However, others of these rules should **NOT** be disabled because they encourage best accessibility practices. Disabling these rules will negatively impact accessibility. These rules are defined in [accessibility.json](./accessibility.json).
83
+
84
+
To review configurations supported by `markdownlint`, see [`markdownlint-cli2` configuration](https://github.com/DavidAnson/markdownlint-cli2#configuration).
76
85
77
86
### Advanced: Adding custom rules in your codebase
0 commit comments