Skip to main content

remark-lint

Supported VersionLanguageWebsite
7.0.0+ (default: 9.0.0) ¹Markdownhttps://github.com/remarkjs/remark-lint

remark-lint is a pluggable linter for Markdown. It includes many rules to enforce consistency and detect possible mistakes.

¹ Note that this version is actually remark-cli's, not remark-lint's. Sider requires only remark-cli.

Getting Started#

To start using remark-lint, enable it in your repository settings.

Sider enables some useful rules by default, so you can get started out of the box.

In addition, you can use some rules or plugins as you want. If doing so, you need to install remark-lint on your repository via npm, for example:

$ npm install --save-dev remark-cli remark-lint remark-preset-lint-recommended

then, configure remark-lint via a configuration file like package.json, for example:

{  "scripts": {    "lint-md": "remark ."  },  "remarkConfig": {    "plugins": ["remark-preset-lint-recommended"]  }}

For more details, see the document.

Configuration#

Here is a configuration example via sider.yml:

linter:  remark_lint:    target: docs/    ext: md,markdown    rc-path: config/.remarkrc    ignore-path: config/.remarkignore    use:      - remark-lint-file-extension      - remark-lint-no-heading-punctuation

You can use the following options to fine-tune remark-lint to your project:

NameTypeDefault
root_dirstring-
dependenciesstring[], map[]-
npm_installboolean, string-
targetstring, string[].
extstring-
rc-pathstring-
ignore-pathstring-
usestring, string[]-

For more details about the CLI options of remark-lint, see the document.

target#

This option allows you to specify files or directories to analyze. You can specify also glob patterns.

For example:

linter:  remark_lint:    target:      - docs/      - manual/**/doc-*.md

ext#

This option allows you to specify file extensions to analyze, and the value should be comma-separated. By default, remark-lint tries to find all markdown files as possible, so you may not usually need to use this option.

For example, if you want to analyze only *.md and *.mdown files, you need to set the option as follows:

linter:  remark_lint:    ext: md,mdown

rc-path#

This option allows you to specify a .remarkrc file.

For example:

linter:  remark_lint:    rc-path: config/.remarkrc

ignore-path#

This option allows you to specify a .remarkignore file. By default, remark-lint automatically finds a ignore file in a project, so you may not usually need to use this option.

For example:

linter:  remark_lint:    ignore-path: config/.remarkignore

use#

This option allows you to specify plugins. See also the "configuration files" section.

For example:

linter:  remark_lint:    use:      - remark-lint-file-extension      - remark-lint-no-heading-punctuation

Configuration files for remark-lint#

remark-lint has own mechanism to use configuration files such as .remarkrc, .remarkrc.yml, or package.json.

For example, you can configure plugins via the following .remarkrc.yml file:

plugins:  - remark-preset-lint-recommended  - ["remark-lint-list-item-indent", false]

Note that all the remark-lint presets and rules are implemented as a remark plugin. If you want to configure some presets or rules for remark-lint, you need to specify them to plugins as the example above.