Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An opinionated collection of markdownlint rules used by GitHub.

License

NotificationsYou must be signed in to change notification settings

github/markdownlint-github

Repository files navigation

This repository provides GitHub's recommendedmarkdownlint configurations, and additional rules for use on GitHub open source and internal projects.

Opinions

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.

Rules

The following are custom rules defined in this plugin.

Seemarkdownlint rules for documentation on rules pulled in frommarkdownlint.

Usage

Important: We support the use ofmarkdownlint throughmarkdownlint-cli2 instead ofmarkdownlint-cli for compatibility with thevscode-markdownlint plugin.

  1. Create a.markdownlint-cli2.mjs file in the root of your repository.

    touch .markdownlint-cli2.mjs
  2. 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
  3. Add/modify your linting script inpackage.json.

    "scripts": {"lint:markdown":"markdownlint-cli2\"**/*.{md,mdx}\"\"!node_modules\""}
  4. Edit.markdownlint-cli2.mjs file to suit your needs. Start with

    importconfigOptions,{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
  5. Install thevscode-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.

Customizing configurations

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.

Advanced: Adding custom rules in your codebase

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.

License

This project is licensed under the terms of the MIT open source license. Pleaserefer tothe MIT license for the full terms.

Maintainers

SeeCODEOWNERS.

Contributing

Please readContributing Guide for more information.

About

An opinionated collection of markdownlint rules used by GitHub.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors13


[8]ページ先頭

©2009-2025 Movatter.jp