GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - github/markdownlint-github: An opinionated collection of markdownlint rules used by GitHub.

BranchesTags
Open more actions menu

Latest commit

 

History

223 Commits
223 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs/rules
docs/rules
 
 
src
src
 
 
style
style
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.markdownlint-cli2.mjs
.markdownlint-cli2.mjs
 
 
.npmrc
.npmrc
 
 
.nvmrc
.nvmrc
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODEOWNERS
CODEOWNERS
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
SUPPORT.md
SUPPORT.md
 
 
eslint.config.js
eslint.config.js
 
 
index.js
index.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
vitest.config.js
vitest.config.js
 
 

Repository files navigation

Markdownlint-github

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

Opinions

In addition to defaults defined by markdownlint, we use this repository to enforce rules not defined by default, including our own custom rules.

See opinions codified in index.js.

Rules

The following are custom rules defined in this plugin.

  • GH001 no-default-alt-text
  • GH002 no-generic-link-text
  • GH003 no-empty-alt-text

See markdownlint rules for documentation on rules pulled in from markdownlint.

Usage

Important: We support the use of markdownlint through markdownlint-cli2 instead of markdownlint-cli for compatibility with the vscode-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 updates
    npm install -D @github/markdownlint-github [--@github:registry=https://registry.npmjs.org]
    npm install -D markdownlint-cli2-formatter-pretty
  3. Add/modify your linting script in package.json.

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

    import markdownIt from "markdown-it"
    import configOptions, {init} from "@github/markdownlint-github"
    const markdownItFactory = () => markdownIt({ html: true })
    const options = {
        config: init(),
        customRules: ["@github/markdownlint-github"],
        markdownItFactory,
        outputFormatters: [
          [ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] // ensures the error message includes a link to the rule documentation
        ]
    }
    export default options

    Or, you can also pass in configuration options that you wish to override the default. Read more at Customizing configurations. This looks like:

    import markdownIt from "markdown-it"
    import configOptions, {init} from "@github/markdownlint-github"
    const overriddenOptions = init({
        'fenced-code-language': false, // Custom overrides
    })
    const markdownItFactory = () => markdownIt({ html: true })
    const options = {
        config: overriddenOptions,
        customRules: ["@github/markdownlint-github"],
        markdownItFactory,
        outputFormatters: [
          [ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ]
        ]
    }
    export default options
  5. Install the vscode-markdownlint plugin to ensure markdownlint 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 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.

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.

To review configurations supported by markdownlint, see markdownlint-cli2 configuration.

Advanced: Adding custom rules in your codebase

You may write custom rules within your repository. Follow the custom rules guide in markdownlint to write your rule.

The rule will need to be enabled in the configuration. For instance, if you introduce some-rule.js with the name "some-rule", you must set the path of the custom rule in the .markdownlint-cli2.mjs file:

import configOptions, {init} from "@github/markdownlint-github"
import markdownIt from "markdown-it"
const markdownItFactory = () => markdownIt({ html: true })
const options = init({
    "some-rule": true,
    customRules: ["@github/markdownlint-github", "some-rule.js"],
    markdownItFactory
})
export default options

See markdownlint-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. Please refer to the MIT license for the full terms.

Maintainers

See CODEOWNERS.

Contributing

Please read Contributing Guide for more information.

About

An opinionated collection of markdownlint rules used by GitHub.

Topics

markdownlintmarkdownlint-rule

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

102 stars

Watchers

166 watching

Forks

13 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.