- Notifications
You must be signed in to change notification settings - Fork5
An opinionated collection of markdownlint rules used by GitHub.
License
github/markdownlint-github
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository provides GitHub's recommendedmarkdownlint
configurations, and additional rules for use on GitHub open source and internal projects.
In addition to defaults defined bymarkdownlint
, we use this repository to enforce rules not defined by default, including our own custom rules.
See opinions codified inindex.js.
The following are custom rules defined in this plugin.
Seemarkdownlint
rules for documentation on rules pulled in frommarkdownlint
.
Important: We support the use ofmarkdownlint
throughmarkdownlint-cli2
instead ofmarkdownlint-cli
for compatibility with thevscode-markdownlint
plugin.
Create a
.markdownlint-cli2.mjs
file in the root of your repository.touch .markdownlint-cli2.mjs
Install packages.
npm install -D markdownlint-cli2# if updating existing package, check for updatesnpm install -D @github/markdownlint-github [--@github:registry=https://registry.npmjs.org]npm install -D markdownlint-cli2-formatter-pretty
Add/modify your linting script in
package.json
."scripts": {"lint:markdown":"markdownlint-cli2\"**/*.{md,mdx}\"\"!node_modules\""}
Edit
.markdownlint-cli2.mjs
file to suit your needs. Start withimportconfigOptions,{init}from"@github/markdownlint-github"constoptions={config:init(),customRules:["@github/markdownlint-github"],outputFormatters:[["markdownlint-cli2-formatter-pretty",{"appendLink":true}]// ensures the error message includes a link to the rule documentation]}exportdefaultoptions
Or, you can also pass in configuration options that you wish to override the default. Read more atCustomizing configurations.This looks like:
importconfigOptions,{init}from"@github/markdownlint-github"constoverriddenOptions=init({'fenced-code-language':false,// Custom overrides})constoptions={config:overriddenOptions,customRules:["@github/markdownlint-github"],outputFormatters:[["markdownlint-cli2-formatter-pretty",{"appendLink":true}]]}exportdefaultoptions
Install the
vscode-markdownlint
plugin to ensuremarkdownlint
violations are surfaced in the file. This plugin should flag rules based off your.markdownlint-cli2.mjs
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.
You may determine that the defaults set by this plugin are not suitable for your project.
This plugin will pull in the the defaults defined bymarkdownlint
, 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.
However, others of these rules shouldNOT be disabled because they encourage best accessibility practices. Disabling these rules will negatively impact accessibility. These rules are defined inaccessibility.json.
To review configurations supported bymarkdownlint
, seemarkdownlint-cli2
configuration.
You may write custom rules within your repository. Follow thecustom rules guide inmarkdownlint
to write your rule.
The rule will need to be enabled in the configuration. For instance, if you introducesome-rule.js
with the name "some-rule", you must set the path of the custom rule in the.markdownlint-cli2.mjs
file:
importconfigOptions,{init}from"@github/markdownlint-github"constoptions=init({"some-rule":true,customRules:["@github/markdownlint-github","some-rule.js"],})exportdefaultoptions
Seemarkdownlint-cli2
configuration.
Consider upstreaming any rules you find useful as proposals to this repository.
This project is licensed under the terms of the MIT open source license. Pleaserefer tothe MIT license for the full terms.
SeeCODEOWNERS.
Please readContributing Guide for more information.
About
An opinionated collection of markdownlint rules used by GitHub.
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors13
Uh oh!
There was an error while loading.Please reload this page.