2015-03-12 23:42:06 -07:00
# markdownlint
2016-03-11 21:36:39 -08:00
> A Node.js style checker and lint tool for Markdown/CommonMark files.
2015-03-12 23:42:06 -07:00
2015-03-17 22:58:26 -07:00
[![npm version][npm-image]][npm-url]
[![License][license-image]][license-url]
2015-03-12 23:42:06 -07:00
## Install
```shell
npm install markdownlint --save-dev
```
## Overview
2021-01-08 21:53:55 -08:00
The [Markdown ](https://en.wikipedia.org/wiki/Markdown ) markup language
is designed to be easy to read, write, and understand. It succeeds -
and its flexibility is both a benefit and a drawback. Many styles are
possible, so formatting can be inconsistent. Some constructs don't
work well in all parsers and should be avoided. The
[CommonMark ](https://commonmark.org/ ) specification standardizes
parsers - but not authors.
2015-03-12 23:42:06 -07:00
2019-05-06 22:00:38 -07:00
`markdownlint` is a
[static analysis ](https://en.wikipedia.org/wiki/Static_program_analysis )
tool for [Node.js ](https://nodejs.org/ ) with a library of rules
to enforce standards and consistency for Markdown files. It was
inspired by - and heavily influenced by - Mark Harrison's
2017-06-18 15:49:33 -07:00
[markdownlint ](https://github.com/markdownlint/markdownlint ) for
2019-05-06 22:00:38 -07:00
[Ruby ](https://www.ruby-lang.org/ ). The initial rules, rule documentation,
and test cases came directly from that project.
2015-03-12 23:42:06 -07:00
2016-01-14 22:15:44 -08:00
### Related
2020-06-22 20:59:13 -07:00
* CLI
2021-10-08 16:35:37 +01:00
* [markdownlint-cli ](https://github.com/igorshubovych/markdownlint-cli ) command-line interface for Node.js ([works with pre-commit ](https://github.com/igorshubovych/markdownlint-cli#use-with-pre-commit ))
* [markdownlint-cli2 ](https://github.com/DavidAnson/markdownlint-cli2 ) command-line interface for Node.js ([works with pre-commit ](https://github.com/DavidAnson/markdownlint-cli2#pre-commit ))
2020-06-22 20:59:13 -07:00
* GitHub
* [GitHub Super-Linter Action ](https://github.com/github/super-linter )
* [GitHub Actions problem matcher for markdownlint-cli ](https://github.com/xt0rted/markdownlint-problem-matcher )
* Editor
2021-01-08 21:53:55 -08:00
* [vscode-markdownlint extension for VS Code ](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint )
2020-06-22 20:59:13 -07:00
* [Sublime Text markdownlint for Sublime Text ](https://packagecontrol.io/packages/SublimeLinter-contrib-markdownlint )
* [linter-node-markdownlint extension for Atom ](https://atom.io/packages/linter-node-markdownlint )
* [coc-markdownlint extension for Vim/Neovim ](https://github.com/fannheyward/coc-markdownlint )
* Tooling
* [grunt-markdownlint for the Grunt task runner ](https://github.com/sagiegurari/grunt-markdownlint )
* [Cake.Markdownlint addin for Cake build automation system ](https://github.com/cake-contrib/Cake.Markdownlint )
* Ruby
* [markdownlint/mdl gem for Ruby ](https://rubygems.org/gems/mdl )
2015-03-12 23:42:06 -07:00
2015-05-07 18:24:35 -07:00
## Demonstration
2016-10-05 22:50:21 -07:00
[`markdownlint` demo ](https://dlaa.me/markdownlint/ ), an interactive, in-browser
2015-05-07 18:24:35 -07:00
playground for learning and exploring.
2016-01-12 21:29:17 -08:00
## Rules / Aliases
2021-01-08 21:53:55 -08:00
<!-- markdownlint - disable line - length -->
2018-04-18 22:25:45 -07:00
* **[MD001 ](doc/Rules.md#md001 )** *heading-increment/header-increment* - Heading levels should only increment by one level at a time
2020-12-28 13:28:38 -08:00
* ~~**[MD002 ](doc/Rules.md#md002 )** *first-heading-h1/first-header-h1* - First heading should be a top-level heading~~
2018-04-18 22:25:45 -07:00
* **[MD003 ](doc/Rules.md#md003 )** *heading-style/header-style* - Heading style
2017-05-07 12:48:04 -07:00
* **[MD004 ](doc/Rules.md#md004 )** *ul-style* - Unordered list style
* **[MD005 ](doc/Rules.md#md005 )** *list-indent* - Inconsistent indentation for list items at the same level
2020-01-13 19:19:49 -08:00
* ~~**[MD006 ](doc/Rules.md#md006 )** *ul-start-left* - Consider starting bulleted lists at the beginning of the line~~
2017-05-07 12:48:04 -07:00
* **[MD007 ](doc/Rules.md#md007 )** *ul-indent* - Unordered list indentation
* **[MD009 ](doc/Rules.md#md009 )** *no-trailing-spaces* - Trailing spaces
* **[MD010 ](doc/Rules.md#md010 )** *no-hard-tabs* - Hard tabs
* **[MD011 ](doc/Rules.md#md011 )** *no-reversed-links* - Reversed link syntax
* **[MD012 ](doc/Rules.md#md012 )** *no-multiple-blanks* - Multiple consecutive blank lines
* **[MD013 ](doc/Rules.md#md013 )** *line-length* - Line length
* **[MD014 ](doc/Rules.md#md014 )** *commands-show-output* - Dollar signs used before commands without showing output
2018-03-19 23:39:42 +01:00
* **[MD018 ](doc/Rules.md#md018 )** *no-missing-space-atx* - No space after hash on atx style heading
* **[MD019 ](doc/Rules.md#md019 )** *no-multiple-space-atx* - Multiple spaces after hash on atx style heading
* **[MD020 ](doc/Rules.md#md020 )** *no-missing-space-closed-atx* - No space inside hashes on closed atx style heading
* **[MD021 ](doc/Rules.md#md021 )** *no-multiple-space-closed-atx* - Multiple spaces inside hashes on closed atx style heading
2018-04-18 22:25:45 -07:00
* **[MD022 ](doc/Rules.md#md022 )** *blanks-around-headings/blanks-around-headers* - Headings should be surrounded by blank lines
* **[MD023 ](doc/Rules.md#md023 )** *heading-start-left/header-start-left* - Headings must start at the beginning of the line
* **[MD024 ](doc/Rules.md#md024 )** *no-duplicate-heading/no-duplicate-header* - Multiple headings with the same content
2020-12-28 13:28:38 -08:00
* **[MD025 ](doc/Rules.md#md025 )** *single-title/single-h1* - Multiple top-level headings in the same document
2018-03-19 23:39:42 +01:00
* **[MD026 ](doc/Rules.md#md026 )** *no-trailing-punctuation* - Trailing punctuation in heading
2017-05-07 12:48:04 -07:00
* **[MD027 ](doc/Rules.md#md027 )** *no-multiple-space-blockquote* - Multiple spaces after blockquote symbol
* **[MD028 ](doc/Rules.md#md028 )** *no-blanks-blockquote* - Blank line inside blockquote
* **[MD029 ](doc/Rules.md#md029 )** *ol-prefix* - Ordered list item prefix
* **[MD030 ](doc/Rules.md#md030 )** *list-marker-space* - Spaces after list markers
* **[MD031 ](doc/Rules.md#md031 )** *blanks-around-fences* - Fenced code blocks should be surrounded by blank lines
* **[MD032 ](doc/Rules.md#md032 )** *blanks-around-lists* - Lists should be surrounded by blank lines
* **[MD033 ](doc/Rules.md#md033 )** *no-inline-html* - Inline HTML
* **[MD034 ](doc/Rules.md#md034 )** *no-bare-urls* - Bare URL used
* **[MD035 ](doc/Rules.md#md035 )** *hr-style* - Horizontal rule style
2018-04-18 22:25:45 -07:00
* **[MD036 ](doc/Rules.md#md036 )** *no-emphasis-as-heading/no-emphasis-as-header* - Emphasis used instead of a heading
2017-05-07 12:48:04 -07:00
* **[MD037 ](doc/Rules.md#md037 )** *no-space-in-emphasis* - Spaces inside emphasis markers
* **[MD038 ](doc/Rules.md#md038 )** *no-space-in-code* - Spaces inside code span elements
* **[MD039 ](doc/Rules.md#md039 )** *no-space-in-links* - Spaces inside link text
* **[MD040 ](doc/Rules.md#md040 )** *fenced-code-language* - Fenced code blocks should have a language specified
2020-12-28 13:28:38 -08:00
* **[MD041 ](doc/Rules.md#md041 )** *first-line-heading/first-line-h1* - First line in a file should be a top-level heading
2017-05-07 12:48:04 -07:00
* **[MD042 ](doc/Rules.md#md042 )** *no-empty-links* - No empty links
2018-04-18 22:25:45 -07:00
* **[MD043 ](doc/Rules.md#md043 )** *required-headings/required-headers* - Required heading structure
2017-05-07 12:48:04 -07:00
* **[MD044 ](doc/Rules.md#md044 )** *proper-names* - Proper names should have the correct capitalization
2018-01-06 18:06:32 -08:00
* **[MD045 ](doc/Rules.md#md045 )** *no-alt-text* - Images should have alternate text (alt text)
2019-04-17 14:42:17 -07:00
* **[MD046 ](doc/Rules.md#md046 )** *code-block-style* - Code block style
2019-04-05 12:36:12 +02:00
* **[MD047 ](doc/Rules.md#md047 )** *single-trailing-newline* - Files should end with a single newline character
2019-10-08 21:10:02 -07:00
* **[MD048 ](doc/Rules.md#md048 )** *code-fence-style* - Code fence style
2021-10-24 06:54:58 +02:00
* **[MD049 ](doc/Rules.md#md049 )** *emphasis-style* - Emphasis style should be consistent
2021-10-21 06:42:48 +02:00
* **[MD050 ](doc/Rules.md#md050 )** *strong-style* - Strong style should be consistent
2015-03-14 22:34:28 -07:00
2021-01-08 21:53:55 -08:00
<!-- markdownlint - restore -->
2015-03-14 22:34:28 -07:00
See [Rules.md ](doc/Rules.md ) for more details.
2015-03-12 23:42:06 -07:00
2019-07-08 13:10:08 -05:00
~~Struck through~~ rules are deprecated, and provided for backward-compatibility.
2021-01-08 21:53:55 -08:00
> All rules with `heading` as part of their name are also available as
> `header` aliases (e.g. `heading-increment` is also available as `header-increment`).
2018-04-18 22:25:45 -07:00
> The use of `header` is deprecated and provided for backward-compatibility.
2018-03-19 23:39:42 +01:00
2015-03-16 22:31:18 -07:00
## Tags
2021-01-08 21:53:55 -08:00
Tags group related rules and can be used to enable/disable multiple
rules at once.
2018-05-24 21:57:32 -07:00
2017-12-29 17:01:21 -08:00
* **accessibility** - MD045
2015-03-16 22:31:18 -07:00
* **atx** - MD018, MD019
* **atx_closed** - MD020, MD021
2019-04-05 12:36:12 +02:00
* **blank_lines** - MD012, MD022, MD031, MD032, MD047
2015-03-16 22:31:18 -07:00
* **blockquote** - MD027, MD028
* **bullet** - MD004, MD005, MD006, MD007, MD032
2019-10-08 21:10:02 -07:00
* **code** - MD014, MD031, MD038, MD040, MD046, MD048
2021-10-24 06:54:58 +02:00
* **emphasis** - MD036, MD037, MD049, MD050
2015-03-17 22:34:47 -07:00
* **hard_tab** - MD010
2021-01-08 21:53:55 -08:00
* **headers** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022,
MD023, MD024, MD025, MD026, MD036, MD041, MD043
* **headings** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022,
MD023, MD024, MD025, MD026, MD036, MD041, MD043
2015-04-14 09:40:16 -07:00
* **hr** - MD035
2015-04-14 00:01:57 -07:00
* **html** - MD033
2017-12-29 17:01:21 -08:00
* **images** - MD045
2015-03-16 22:31:18 -07:00
* **indentation** - MD005, MD006, MD007, MD027
2015-04-16 09:13:56 -07:00
* **language** - MD040
2015-03-16 22:31:18 -07:00
* **line_length** - MD013
2016-06-27 22:19:02 -07:00
* **links** - MD011, MD034, MD039, MD042
2015-03-16 22:31:18 -07:00
* **ol** - MD029, MD030, MD032
* **spaces** - MD018, MD019, MD020, MD021, MD023
2016-12-22 13:34:18 -08:00
* **spelling** - MD044
2015-03-16 22:31:18 -07:00
* **ul** - MD004, MD005, MD006, MD007, MD030, MD032
2015-04-14 00:01:57 -07:00
* **url** - MD034
2021-01-08 21:53:55 -08:00
* **whitespace** - MD009, MD010, MD012, MD027, MD028, MD030, MD037,
MD038, MD039
2015-03-16 22:31:18 -07:00
2015-09-26 16:55:33 -07:00
## Configuration
2021-01-08 21:53:55 -08:00
Text passed to `markdownlint` is parsed as Markdown, analyzed, and any
issues reported. Two kinds of text are ignored:
2017-07-16 23:08:47 -07:00
* [HTML comments ](https://www.w3.org/TR/html5/syntax.html#comments )
2021-01-08 21:53:55 -08:00
* [Front matter ](https://jekyllrb.com/docs/frontmatter/ ) (see
`options.frontMatter` below)
2017-07-16 23:08:47 -07:00
2021-01-08 21:53:55 -08:00
Rules can be enabled, disabled, and configured via `options.config`
(described below) to define the expected behavior for a set of inputs.
To enable or disable rules at a particular location within a file, add
one of these markers to the appropriate place (HTML comments don't
appear in the final markup):
2015-09-26 16:55:33 -07:00
2019-12-04 21:31:49 -08:00
* Disable all rules: `<!-- markdownlint-disable -->`
* Enable all rules: `<!-- markdownlint-enable -->`
2020-11-22 14:02:36 -08:00
* Disable all rules for the next line only: `<!-- markdownlint-disable-next-line -->`
2019-06-08 19:26:11 -07:00
* Disable one or more rules by name: `<!-- markdownlint-disable MD001 MD005 -->`
* Enable one or more rules by name: `<!-- markdownlint-enable MD001 MD005 -->`
2020-11-22 14:02:36 -08:00
* Disable one or more rules by name for the next line only: `<!-- markdownlint-disable-next-line MD001 MD005 -->`
2019-06-08 19:26:11 -07:00
* Capture the current rule configuration: `<!-- markdownlint-capture -->`
* Restore the captured rule configuration: `<!-- markdownlint-restore -->`
2015-09-26 16:55:33 -07:00
For example:
2020-11-22 14:02:36 -08:00
```markdown
<!-- markdownlint - disable - next - line no - space - in - emphasis -->
deliberate space * in * emphasis
```
Or:
2018-03-03 22:22:02 -08:00
```markdown
2019-06-08 19:26:11 -07:00
<!-- markdownlint - disable no - space - in - emphasis -->
2015-09-26 16:55:33 -07:00
deliberate space * in * emphasis
2019-06-08 19:26:11 -07:00
<!-- markdownlint - enable no - space - in - emphasis -->
```
To temporarily disable rule(s), then restore the former configuration:
```markdown
<!-- markdownlint - capture -->
<!-- markdownlint - disable -->
any violations you want
<!-- markdownlint - restore -->
```
2021-01-08 21:53:55 -08:00
The initial configuration is captured by default (as if every document
began with `<!-- markdownlint-capture -->` ), so the pattern above can
be expressed more simply:
2019-06-08 19:26:11 -07:00
```markdown
<!-- markdownlint - disable -->
any violations you want
<!-- markdownlint - restore -->
2015-09-26 16:55:33 -07:00
```
Changes take effect starting with the line a comment is on, so the following
has no effect:
2018-03-03 22:22:02 -08:00
```markdown
2015-09-26 16:55:33 -07:00
space * in * emphasis <!-- markdownlint-disable --> <!-- markdownlint-enable -->
```
2019-12-04 21:31:49 -08:00
To apply changes to an entire file regardless of where the comment is located,
the following syntax is supported:
* Disable all rules: `<!-- markdownlint-disable-file -->`
* Enable all rules: `<!-- markdownlint-enable-file -->`
* Disable one or more rules by name: `<!-- markdownlint-disable-file MD001 -->`
* Enable one or more rules by name: `<!-- markdownlint-enable-file MD001 -->`
This can be used to "hide" `markdownlint` comments at the bottom of a file.
2021-01-08 21:53:55 -08:00
In cases where it is desirable to change the configuration of one or
more rules for a file, the following more advanced syntax is supported:
2020-04-05 19:47:12 -07:00
2020-05-19 22:16:31 +01:00
* Configure: `<!-- markdownlint-configure-file { options.config JSON } -->`
2020-04-05 19:47:12 -07:00
For example:
```markdown
<!-- markdownlint - configure - file { "MD013": { "line_length": 70 } } -->
```
or
```markdown
<!-- markdownlint - configure - file
{
"hr-style": {
"style": "---"
},
"no-trailing-spaces": false
}
-->
```
2021-01-08 21:53:55 -08:00
These changes apply to the entire file regardless of where the comment
is located. Multiple such comments (if present) are applied top-to-bottom.
2020-04-05 19:47:12 -07:00
2015-03-15 23:39:17 -07:00
## API
2017-05-19 22:36:46 -07:00
### Linting
2020-09-13 12:58:09 -07:00
Standard asynchronous API:
2015-03-20 00:09:55 -07:00
2015-03-15 23:39:17 -07:00
```js
/**
2017-05-19 22:36:46 -07:00
* Lint specified Markdown files.
2015-03-15 23:39:17 -07:00
*
2020-09-13 12:58:09 -07:00
* @param {Options} options Configuration options.
* @param {LintCallback} callback Callback (err, result) function.
2015-03-15 23:39:17 -07:00
* @returns {void}
*/
function markdownlint(options, callback) { ... }
```
2020-09-13 12:58:09 -07:00
Synchronous API (for build scripts, etc.):
2015-03-20 00:09:55 -07:00
```js
/**
2017-05-19 22:36:46 -07:00
* Lint specified Markdown files synchronously.
2015-03-20 00:09:55 -07:00
*
2020-09-13 12:58:09 -07:00
* @param {Options} options Configuration options.
* @returns {LintResults} Results object.
2015-03-20 00:09:55 -07:00
*/
function markdownlint.sync(options) { ... }
```
2020-09-13 12:58:09 -07:00
Promise API (in the `promises` namespace like Node.js's
[`fs` Promises API ](https://nodejs.org/api/fs.html#fs_fs_promises_api )):
```js
/**
* Lint specified Markdown files.
*
* @param {Options} options Configuration options.
* @returns {Promise< LintResults > } Results object.
*/
function markdownlint(options) { ... }
```
2017-05-19 22:36:46 -07:00
#### options
2015-03-15 23:39:17 -07:00
Type: `Object`
2021-08-12 19:38:03 -07:00
Configures the function. All properties are optional, but at least one
of `files` or `strings` should be set to provide input.
2015-03-15 23:39:17 -07:00
2018-02-15 21:35:58 -08:00
##### options.customRules
Type: `Array` of `Object`
List of custom rules to include with the default rule set for linting.
2021-01-08 21:53:55 -08:00
Each array element should define a rule. Rules are typically exported
by another package, but can be defined locally. Custom rules are
identified by the
2020-09-06 16:31:26 -07:00
[keyword `markdownlint-rule` on npm ](https://www.npmjs.com/search?q=keywords:markdownlint-rule ).
2018-02-15 21:35:58 -08:00
Example:
```js
2018-04-27 22:05:34 -07:00
const extraRules = require("extraRules");
const options = {
2018-02-15 21:35:58 -08:00
"customRules": [ extraRules.one, extraRules.two ]
};
```
2021-01-08 21:53:55 -08:00
See [CustomRules.md ](doc/CustomRules.md ) for details about authoring
custom rules.
2018-02-15 21:35:58 -08:00
2017-05-19 22:36:46 -07:00
##### options.files
2015-03-15 23:39:17 -07:00
Type: `Array` of `String`
List of files to lint.
Each array element should be a single file (via relative or absolute path);
2021-01-08 21:53:55 -08:00
[globbing ](https://en.wikipedia.org/wiki/Glob_%28programming%29 ) is the
caller's responsibility.
2015-03-15 23:39:17 -07:00
Example: `[ "one.md", "dir/two.md" ]`
2017-05-19 22:36:46 -07:00
##### options.strings
2015-04-29 18:46:52 -07:00
Type: `Object` mapping `String` to `String`
Map of identifiers to strings for linting.
2021-01-08 21:53:55 -08:00
When Markdown content is not available as files, it can be passed as
strings. The keys of the `strings` object are used to identify each
input value in the `result` summary.
2015-04-29 18:46:52 -07:00
Example:
```json
{
"readme": "# README\n...",
"changelog": "# CHANGELOG\n..."
}
```
2017-05-19 22:36:46 -07:00
##### options.config
2015-03-15 23:39:17 -07:00
2015-03-16 22:31:18 -07:00
Type: `Object` mapping `String` to `Boolean | Object`
2015-03-15 23:39:17 -07:00
Configures the rules to use.
2016-01-12 21:29:17 -08:00
Object keys are rule names or aliases and values are the rule's configuration.
2015-03-15 23:39:17 -07:00
The value `false` disables a rule, `true` enables its default configuration,
and passing an object customizes its settings. Setting the special `default`
2021-01-08 21:53:55 -08:00
rule to `true` or `false` includes/excludes all rules by default. Enabling
or disabling a tag name (ex: `whitespace` ) affects all rules having that
tag.
2015-03-18 09:38:32 -07:00
2021-01-08 21:53:55 -08:00
The `default` rule is applied first, then keys are processed in order
from top to bottom with later values overriding earlier ones. Keys
(including rule names, aliases, tags, and `default` ) are not case-sensitive.
2015-03-15 23:39:17 -07:00
Example:
```json
{
"default": true,
2015-03-18 09:38:32 -07:00
"MD003": { "style": "atx_closed" },
"MD007": { "indent": 4 },
2016-01-12 21:29:17 -08:00
"no-hard-tabs": false,
2015-03-18 09:40:01 -07:00
"whitespace": false
2015-03-15 23:39:17 -07:00
}
```
2021-01-21 19:50:57 -08:00
See [.markdownlint.jsonc ](schema/.markdownlint.jsonc ) and/or
[.markdownlint.yaml ](schema/.markdownlint.yaml ) for an example
configuration object with all properties set to the default value.
2021-01-19 20:41:04 -08:00
2021-01-08 21:53:55 -08:00
Sets of rules (known as a "style") can be stored separately and loaded
as [JSON ](https://en.wikipedia.org/wiki/JSON ).
2015-03-18 09:38:32 -07:00
Example:
```js
2018-04-27 22:05:34 -07:00
const options = {
2015-03-18 09:38:32 -07:00
"files": [ "..." ],
"config": require("style/relaxed.json")
};
```
See the [style ](style ) directory for more samples.
2016-10-05 22:21:54 -07:00
See [markdownlint-config-schema.json ](schema/markdownlint-config-schema.json )
2021-01-08 21:53:55 -08:00
for the [JSON Schema ](https://json-schema.org/ ) of the `options.config`
object.
2016-10-05 22:21:54 -07:00
2021-01-08 21:53:55 -08:00
For more advanced scenarios, styles can reference and extend other styles.
The `readConfig` and `readConfigSync` functions can be used to read such
styles.
2017-05-19 22:36:46 -07:00
For example, assuming a `base.json` configuration file:
```json
{
"default": true
}
```
And a `custom.json` configuration file:
```json
{
"extends": "base.json",
"line-length": false
}
```
Then code like the following:
```js
2018-04-27 22:05:34 -07:00
const options = {
2017-05-19 22:36:46 -07:00
"config": markdownlint.readConfigSync("./custom.json")
};
```
Merges `custom.json` and `base.json` and is equivalent to:
```js
2018-04-27 22:05:34 -07:00
const options = {
2017-05-19 22:36:46 -07:00
"config": {
"default": true,
"line-length": false
}
};
```
2017-05-21 22:58:10 -07:00
##### options.frontMatter
Type: `RegExp`
2021-01-08 21:53:55 -08:00
Matches any [front matter ](https://jekyllrb.com/docs/frontmatter/ )
found at the beginning of a file.
2017-05-21 22:58:10 -07:00
2021-01-08 21:53:55 -08:00
Some Markdown content begins with metadata; the default `RegExp` for
this option ignores common forms of "front matter". To match differently,
specify a custom `RegExp` or use the value `null` to disable the feature.
2017-05-21 22:58:10 -07:00
2017-07-02 20:33:29 -07:00
The default value:
2017-05-21 22:58:10 -07:00
```js
2020-11-14 19:40:15 -08:00
/((^---\s*$[^]*?^---\s*$)|(^\+\+\+\s*$[^]*?^(\+\+\+|\.\.\.)\s*$)|(^\{\s*$[^]*?^\}\s*$))(\r\n|\r|\n|$)/m
2017-05-21 22:58:10 -07:00
```
2020-11-14 19:40:15 -08:00
Ignores [YAML ](https://en.wikipedia.org/wiki/YAML ),
[TOML ](https://en.wikipedia.org/wiki/TOML ), and
[JSON ](https://en.wikipedia.org/wiki/JSON ) front matter such as:
2017-05-21 22:58:10 -07:00
```text
---
layout: post
title: Title
---
```
2017-07-02 20:33:29 -07:00
Note: Matches must occur at the start of the file.
2019-05-18 12:32:52 -07:00
##### options.handleRuleFailures
Type: `Boolean`
2021-01-08 21:53:55 -08:00
Catches exceptions thrown during rule processing and reports the problem
as a rule violation.
2019-05-18 12:32:52 -07:00
By default, exceptions thrown by rules (or the library itself) are unhandled
and bubble up the stack to the caller in the conventional manner. By setting
2021-01-08 21:53:55 -08:00
`handleRuleFailures` to `true` , exceptions thrown by failing rules will
be handled by the library and the exception message logged as a rule violation.
2019-05-18 12:32:52 -07:00
This setting can be useful in the presence of (custom) rules that encounter
2021-01-08 21:53:55 -08:00
unexpected syntax and fail. By enabling this option, the linting process
is allowed to continue and report any violations that were found.
2019-05-18 12:32:52 -07:00
2017-05-21 22:58:10 -07:00
##### options.noInlineConfig
Type: `Boolean`
Disables the use of HTML comments like `<!-- markdownlint-disable -->` to toggle
rules within the body of Markdown content.
By default, properly-formatted inline comments can be used to create exceptions
for parts of a document. Setting `noInlineConfig` to `true` ignores all such
comments.
2017-05-19 22:36:46 -07:00
##### options.resultVersion
2016-10-16 21:46:02 -07:00
Type: `Number`
Specifies which version of the `result` object to return (see the "Usage" section
below for examples).
Passing a `resultVersion` of `0` corresponds to the original, simple format where
2019-08-16 19:56:52 -07:00
each error is identified by rule name and line number. *This is deprecated.*
2016-10-16 21:46:02 -07:00
2017-07-05 21:53:21 -07:00
Passing a `resultVersion` of `1` corresponds to a detailed format where each error
includes information about the line number, rule name, alias, description, as well
2019-08-16 19:56:52 -07:00
as any additional detail or context that is available. *This is deprecated.*
2018-01-12 23:21:06 -08:00
Passing a `resultVersion` of `2` corresponds to a detailed format where each error
includes information about the line number, rule names, description, as well as any
2019-08-16 19:56:52 -07:00
additional detail or context that is available. *This is the default.*
Passing a `resultVersion` of `3` corresponds to the detailed version `2` format
2019-09-19 21:49:42 -07:00
with additional information about how to fix automatically-fixable errors. In this
mode, all errors that occur on each line are reported (other versions report only
the first error for each rule).
2016-10-16 21:46:02 -07:00
2019-01-19 12:52:13 -08:00
##### options.markdownItPlugins
Type: `Array` of `Array` of `Function` and plugin parameters
Specifies additional [markdown-it plugins ](https://www.npmjs.com/search?q=keywords:markdown-it-plugin )
to use when parsing input. Plugins can be used to support additional syntax and
features for advanced scenarios.
Each item in the top-level `Array` should be of the form:
```js
[ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ]
```
2021-08-12 19:38:03 -07:00
##### options.fs
Type: `Object` implementing the [file system API ](https://nodejs.org/api/fs.html )
In advanced scenarios, it may be desirable to bypass the default file system API.
If a custom file system implementation is provided, `markdownlint` will use that
instead of invoking `require("fs")` .
Note: The only methods called are `readFile` and `readFileSync` .
2017-05-19 22:36:46 -07:00
#### callback
2015-03-15 23:39:17 -07:00
Type: `Function` taking (`Error` , `Object` )
2015-03-20 00:09:55 -07:00
Standard completion callback.
2017-05-19 22:36:46 -07:00
#### result
2015-03-20 00:09:55 -07:00
Type: `Object`
2015-03-15 23:39:17 -07:00
2015-03-20 00:09:55 -07:00
Call `result.toString()` for convenience or see below for an example of the
2016-01-12 21:29:17 -08:00
structure of the `result` object. Passing the value `true` to `toString()`
uses rule aliases (ex: `no-hard-tabs` ) instead of names (ex: `MD010` ).
2015-03-15 23:39:17 -07:00
2017-05-19 22:36:46 -07:00
### Config
2018-05-23 22:24:40 -07:00
The `options.config` configuration object is simple and can be stored in a file
for readability and easy reuse. The `readConfig` and `readConfigSync` functions
load configuration settings and support the `extends` keyword for referencing
other files (see above).
By default, configuration files are parsed as JSON (and named `.markdownlint.json` ).
Custom parsers can be provided to handle other formats like JSONC, YAML, and TOML.
2017-05-19 22:36:46 -07:00
2020-09-13 12:58:09 -07:00
Asynchronous API:
2017-05-19 22:36:46 -07:00
```js
/**
* Read specified configuration file.
*
2020-09-13 12:58:09 -07:00
* @param {string} file Configuration file name.
* @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function(s).
2021-08-12 19:38:03 -07:00
* @param {Object} [fs] File system implementation.
2020-09-13 12:58:09 -07:00
* @param {ReadConfigCallback} [callback] Callback (err, result) function.
2017-05-19 22:36:46 -07:00
* @returns {void}
*/
2021-08-12 19:38:03 -07:00
function readConfig(file, parsers, fs, callback) { ... }
2017-05-19 22:36:46 -07:00
```
2020-09-13 12:58:09 -07:00
Synchronous API:
2017-05-19 22:36:46 -07:00
```js
/**
* Read specified configuration file synchronously.
*
2020-09-13 12:58:09 -07:00
* @param {string} file Configuration file name.
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
2021-08-12 19:38:03 -07:00
* @param {Object} [fs] File system implementation.
2020-09-13 12:58:09 -07:00
* @returns {Configuration} Configuration object.
2017-05-19 22:36:46 -07:00
*/
2021-08-12 19:38:03 -07:00
function readConfigSync(file, parsers, fs) { ... }
2017-05-19 22:36:46 -07:00
```
2020-09-13 12:58:09 -07:00
Promise API (in the `promises` namespace like Node.js's
2021-08-12 19:38:03 -07:00
[`fs` Promises API ](https://nodejs.org/api/fs.html#fs_promises_api )):
2020-09-13 12:58:09 -07:00
```js
/**
* Read specified configuration file.
*
* @param {string} file Configuration file name.
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
2021-08-12 19:38:03 -07:00
* @param {Object} [fs] File system implementation.
2020-09-13 12:58:09 -07:00
* @returns {Promise< Configuration > } Configuration object.
*/
2021-08-12 19:38:03 -07:00
function readConfig(file, parsers, fs) { ... }
2020-09-13 12:58:09 -07:00
```
2017-05-19 22:36:46 -07:00
#### file
Type: `String`
2018-05-23 22:24:40 -07:00
Location of configuration file to read.
2017-05-19 22:36:46 -07:00
The `file` is resolved relative to the current working directory. If an `extends`
key is present once read, its value will be resolved as a path relative to `file`
and loaded recursively. Settings from a file referenced by `extends` are applied
first, then those of `file` are applied on top (overriding any of the same keys
appearing in the referenced file).
2018-05-23 22:24:40 -07:00
#### parsers
Type: *Optional* `Array` of `Function` taking (`String` ) and returning `Object`
Array of functions to parse configuration files.
The contents of a configuration file are passed to each parser function until one
of them returns a value (vs. throwing an exception). Consequently, strict parsers
should come before flexible parsers.
For example:
```js
2021-02-06 19:23:55 -08:00
[ JSON.parse, require("toml").parse, require("js-yaml").load ]
2018-05-23 22:24:40 -07:00
```
2021-08-12 19:38:03 -07:00
#### fs
Type: *Optional* `Object` implementing the [file system API ](https://nodejs.org/api/fs.html )
In advanced scenarios, it may be desirable to bypass the default file system API.
If a custom file system implementation is provided, `markdownlint` will use that
instead of invoking `require("fs")` .
2021-08-12 20:43:18 -07:00
Note: The only methods called are `readFile` , `readFileSync` , `access` , and `accessSync` .
2021-08-12 19:38:03 -07:00
2017-05-19 22:36:46 -07:00
#### callback
Type: `Function` taking (`Error` , `Object` )
Standard completion callback.
#### result
Type: `Object`
Configuration object.
2015-03-12 23:42:06 -07:00
## Usage
2015-03-14 22:34:28 -07:00
Invoke `markdownlint` and use the `result` object's `toString` method:
2015-03-12 23:42:06 -07:00
```js
2018-04-27 22:05:34 -07:00
const markdownlint = require("markdownlint");
2015-03-14 22:34:28 -07:00
2018-04-27 22:05:34 -07:00
const options = {
2015-04-29 18:46:52 -07:00
"files": [ "good.md", "bad.md" ],
"strings": {
"good.string": "# good.string\n\nThis string passes all rules.",
"bad.string": "#bad .string\n\n#This string fails\tsome rules."
}
2015-03-14 22:34:28 -07:00
};
markdownlint(options, function callback(err, result) {
if (!err) {
console.log(result.toString());
}
});
```
2016-01-12 21:29:17 -08:00
Output:
2015-03-14 22:34:28 -07:00
```text
2017-07-05 21:53:21 -07:00
bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19]
2018-03-19 23:39:42 +01:00
bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad .string"]
2019-03-30 14:43:27 -07:00
bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."]
2020-12-28 13:28:38 -08:00
bad.string: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad .string"]
2017-07-05 21:53:21 -07:00
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
2018-03-19 23:39:42 +01:00
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad .md"]
2019-03-30 14:43:27 -07:00
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
2020-12-28 13:28:38 -08:00
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad .md"]
2015-03-14 22:34:28 -07:00
```
2017-07-05 21:53:21 -07:00
Or invoke `markdownlint.sync` for a synchronous call:
2016-01-12 21:29:17 -08:00
```js
2018-04-27 22:05:34 -07:00
const result = markdownlint.sync(options);
2017-07-05 21:53:21 -07:00
console.log(result.toString());
2016-01-12 21:29:17 -08:00
```
2015-03-20 00:09:55 -07:00
To examine the `result` object directly:
2015-03-14 22:34:28 -07:00
```js
markdownlint(options, function callback(err, result) {
if (!err) {
2017-07-05 21:53:21 -07:00
console.dir(result, { "colors": true, "depth": null });
2015-03-14 22:34:28 -07:00
}
});
```
2015-03-20 00:09:55 -07:00
Output:
2015-03-14 22:34:28 -07:00
2016-10-16 21:46:02 -07:00
```json
{
"good.md": [],
"bad.md": [
2016-10-16 21:46:02 -07:00
{ "lineNumber": 3,
2018-01-12 23:21:06 -08:00
"ruleNames": [ "MD010", "no-hard-tabs" ],
2016-10-16 21:46:02 -07:00
"ruleDescription": "Hard tabs",
2019-01-15 21:56:38 -08:00
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010 ",
2019-03-30 14:43:27 -07:00
"errorDetail": "Column: 17",
2016-10-31 22:53:46 -07:00
"errorContext": null,
2019-03-30 14:43:27 -07:00
"errorRange": [ 17, 1 ] },
2016-10-16 21:46:02 -07:00
{ "lineNumber": 1,
2018-01-12 23:21:06 -08:00
"ruleNames": [ "MD018", "no-missing-space-atx" ],
2018-03-19 23:39:42 +01:00
"ruleDescription": "No space after hash on atx style heading",
2019-01-15 21:56:38 -08:00
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md018 ",
2016-10-16 21:46:02 -07:00
"errorDetail": null,
2016-10-31 22:53:46 -07:00
"errorContext": "#bad .md",
"errorRange": [ 1, 2 ] },
2016-10-16 21:46:02 -07:00
{ "lineNumber": 3,
2018-01-12 23:21:06 -08:00
"ruleNames": [ "MD018", "no-missing-space-atx" ],
2018-03-19 23:39:42 +01:00
"ruleDescription": "No space after hash on atx style heading",
2019-01-15 21:56:38 -08:00
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md018 ",
2016-10-16 21:46:02 -07:00
"errorDetail": null,
2016-10-31 22:53:46 -07:00
"errorContext": "#This file fails\tsome rules.",
2017-07-05 21:53:21 -07:00
"errorRange": [ 1, 2 ] },
{ "lineNumber": 1,
2019-03-30 14:43:27 -07:00
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
2020-12-28 13:28:38 -08:00
"ruleDescription": "First line in a file should be a top-level heading",
2019-01-15 21:56:38 -08:00
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041 ",
2017-07-05 21:53:21 -07:00
"errorDetail": null,
"errorContext": "#bad .md",
"errorRange": null }
2016-10-16 21:46:02 -07:00
]
}
```
2019-02-10 11:38:01 -08:00
Integration with the [gulp ](https://gulpjs.com/ ) build system is straightforward:
2015-03-14 22:34:28 -07:00
```js
2018-04-27 22:05:34 -07:00
const gulp = require("gulp");
const through2 = require("through2");
const markdownlint = require("markdownlint");
2015-03-14 22:34:28 -07:00
gulp.task("markdownlint", function task() {
return gulp.src("*.md", { "read": false })
.pipe(through2.obj(function obj(file, enc, next) {
markdownlint(
{ "files": [ file.relative ] },
function callback(err, result) {
2018-04-27 22:05:34 -07:00
const resultString = (result || "").toString();
2015-03-14 22:34:28 -07:00
if (resultString) {
console.log(resultString);
}
next(err, file);
});
}));
});
```
2015-03-20 00:09:55 -07:00
Output:
2015-03-14 22:34:28 -07:00
```text
[00:00:00] Starting 'markdownlint'...
2017-07-05 21:53:21 -07:00
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
2018-03-19 23:39:42 +01:00
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad .md"]
2019-03-30 14:43:27 -07:00
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
2020-12-28 13:28:38 -08:00
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad .md"]
2015-03-14 22:34:28 -07:00
[00:00:00] Finished 'markdownlint' after 10 ms
2015-03-12 23:42:06 -07:00
```
2019-02-10 11:38:01 -08:00
Integration with the [Grunt ](https://gruntjs.com/ ) build system is similar:
2015-03-14 23:47:34 -07:00
```js
2018-04-27 22:05:34 -07:00
const markdownlint = require("markdownlint");
2015-03-14 23:47:34 -07:00
module.exports = function wrapper(grunt) {
grunt.initConfig({
"markdownlint": {
"example": {
"src": [ "*.md" ]
}
}
});
grunt.registerMultiTask("markdownlint", function task() {
2018-04-27 22:05:34 -07:00
const done = this.async();
2015-03-14 23:47:34 -07:00
markdownlint(
{ "files": this.filesSrc },
function callback(err, result) {
2018-04-27 22:05:34 -07:00
const resultString = err || ((result || "").toString());
2015-03-14 23:47:34 -07:00
if (resultString) {
grunt.fail.warn("\n" + resultString + "\n");
}
done(!err || !resultString);
});
});
};
```
2015-03-20 00:09:55 -07:00
Output:
2015-03-14 23:47:34 -07:00
```text
Running "markdownlint:example" (markdownlint) task
Warning:
2017-07-05 21:53:21 -07:00
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
2018-03-19 23:39:42 +01:00
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad .md"]
2019-03-30 14:43:27 -07:00
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
2020-12-28 13:28:38 -08:00
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad .md"]
2015-03-14 23:47:34 -07:00
Use --force to continue.
```
2015-06-17 18:35:11 -07:00
## Browser
2016-01-12 21:29:17 -08:00
`markdownlint` also works in the browser.
2015-06-17 18:35:11 -07:00
Generate normal and minified scripts with:
```shell
npm run build-demo
```
Then reference `markdown-it` and `markdownlint` :
```html
< script src = "demo/markdown-it.min.js" > < / script >
< script src = "demo/markdownlint-browser.min.js" > < / script >
```
And call it like so:
```js
2018-04-27 22:05:34 -07:00
const options = {
2015-06-17 18:35:11 -07:00
"strings": {
"content": "Some Markdown to lint."
}
};
2018-04-27 22:05:34 -07:00
const results = window.markdownlint.sync(options).toString();
2015-06-17 18:35:11 -07:00
```
2017-11-21 21:58:42 -08:00
## Examples
2021-03-06 20:46:07 +01:00
For ideas how to integrate `markdownlint` into your workflow, refer to the
following projects or one of the tools in the [Related section ](#Related ):
2017-11-21 21:58:42 -08:00
2019-10-19 17:40:13 -07:00
* [.NET Documentation ](https://docs.microsoft.com/en-us/dotnet/ ) ([Search repository ](https://github.com/dotnet/docs/search?q=markdownlint ))
2017-11-21 21:58:42 -08:00
* [ally.js ](https://allyjs.io/ ) ([Search repository ](https://github.com/medialize/ally.js/search?q=markdownlint ))
2019-06-04 21:57:27 -07:00
* [Boostnote ](https://boostnote.io/ ) ([Search repository ](https://github.com/BoostIO/Boostnote/search?q=markdownlint ))
2019-10-02 20:18:10 -07:00
* [CodiMD ](https://github.com/hackmdio/codimd ) ([Search repository ](https://github.com/hackmdio/codimd/search?q=markdownlint ))
2017-11-21 21:58:42 -08:00
* [ESLint ](https://eslint.org/ ) ([Search repository ](https://github.com/eslint/eslint/search?q=markdownlint ))
2020-08-02 14:04:42 -07:00
* [Garden React Components ](https://zendeskgarden.github.io/react-components/ ) ([Search repository ](https://github.com/zendeskgarden/react-components/search?q=markdownlint ))
2021-08-22 15:15:20 -07:00
* [MDN Web Docs ](https://developer.mozilla.org/ ) ([Search repository ](https://github.com/mdn/content/search?q=markdownlint ))
2020-05-12 20:29:07 -07:00
* [MkDocs ](https://www.mkdocs.org/ ) ([Search repository ](https://github.com/mkdocs/mkdocs/search?q=markdownlint ))
2018-01-14 21:59:23 -08:00
* [Mocha ](https://mochajs.org/ ) ([Search repository ](https://github.com/mochajs/mocha/search?q=markdownlint ))
2021-11-10 22:02:51 -08:00
* [Pi-hole documentation ](https://docs.pi-hole.net ) ([Search repository ](https://github.com/pi-hole/docs/search?q=markdownlint ))
2017-11-21 21:58:42 -08:00
* [Reactable ](https://glittershark.github.io/reactable/ ) ([Search repository ](https://github.com/glittershark/reactable/search?q=markdownlint ))
2018-12-14 21:48:25 -08:00
* [Sinon.JS ](https://sinonjs.org/ ) ([Search repository ](https://github.com/sinonjs/sinon/search?q=markdownlint ))
2017-11-21 21:58:42 -08:00
* [TestCafe ](https://devexpress.github.io/testcafe/ ) ([Search repository ](https://github.com/DevExpress/testcafe/search?q=markdownlint ))
2019-05-16 22:21:23 -07:00
* [V8 ](https://v8.dev/ ) ([Search repository ](https://github.com/v8/v8.dev/search?q=markdownlint ))
2018-11-24 19:36:00 -08:00
* [webhint ](https://webhint.io/ ) ([Search repository ](https://github.com/webhintio/hint/search?q=markdownlint ))
2017-11-21 21:58:42 -08:00
* [webpack ](https://webpack.js.org/ ) ([Search repository ](https://github.com/webpack/webpack.js.org/search?q=markdownlint ))
2020-04-25 21:03:31 -07:00
* [WordPress ](https://wordpress.org/gutenberg/ ) ([Search repository ](https://github.com/WordPress/gutenberg/search?q=markdownlint ))
2017-11-21 21:58:42 -08:00
2018-06-24 20:01:44 -07:00
## Contributing
See [CONTRIBUTING.md ](CONTRIBUTING.md ) for more information.
2015-04-17 21:57:10 -07:00
## History
2015-03-12 23:42:06 -07:00
2015-04-17 22:04:45 -07:00
* 0.0.1 - Initial release, includes tests MD001-MD032.
2015-03-17 23:05:37 -07:00
* 0.0.2 - Improve documentation, tests, and code.
2015-03-20 00:29:36 -07:00
* 0.0.3 - Add synchronous API, improve documentation and code.
2015-04-17 22:04:45 -07:00
* 0.0.4 - Add tests MD033-MD040, update dependencies.
2015-05-11 20:57:51 -07:00
* 0.0.5 - Add `strings` option to enable file-less scenarios, add in-browser demo.
2015-06-19 18:48:54 -07:00
* 0.0.6 - Improve performance, simplify in-browser, update dependencies.
2015-07-30 21:41:25 -07:00
* 0.0.7 - Add MD041, improve MD003, ignore front matter, update dependencies.
2015-09-27 12:07:54 -07:00
* 0.0.8 - Support disabling/enabling rules inline, improve code fence, dependencies.
2016-01-16 22:04:37 -08:00
* 0.1.0 - Add aliases, exceptions for MD033, exclusions for MD013, dependencies.
2016-11-12 20:25:07 -08:00
* 0.1.1 - Fix bug handling HTML in tables, reference markdownlint-cli.
2016-07-05 15:03:40 -07:00
* 0.2.0 - Add MD042/MD043, enhance MD002/MD003/MD004/MD007/MD011/MD025/MD041, dependencies.
2016-11-02 22:26:07 -07:00
* 0.3.0 - More detailed error reporting with `resultVersion` , enhance MD010/MD012/MD036,
fixes for MD027/MD029/MD030, include JSON schema, dependencies.
2016-11-12 20:25:07 -08:00
* 0.3.1 - Fix regressions in MD032/MD038, update dependencies.
2017-03-03 23:02:27 -08:00
* 0.4.0 - Add MD044, enhance MD013/MD032/MD041/MD042/MD043, fix for MD038, dependencies.
2017-03-19 21:14:00 -07:00
* 0.4.1 - Fixes for MD038/front matter, improvements to MD044, update dependencies.
2019-05-18 13:36:06 -07:00
* 0.5.0 - Add shareable configuration, `noInlineConfig` option, README links, fix MD030,
2017-05-22 20:04:37 -07:00
improve MD009/MD041, update dependencies.
2017-07-18 21:51:01 -07:00
* 0.6.0 - `resultVersion` defaults to 1 (breaking change), ignore HTML comments, TOML
front matter, fixes for MD044, update dependencies.
2017-09-09 22:29:57 -07:00
* 0.6.1 - Update `markdown-it` versioning, exclude demo/test from publishing.
2017-11-08 21:27:22 -08:00
* 0.6.2 - Improve MD013/MD027/MD034/MD037/MD038/MD041/MD044, update dependencies.
2017-11-13 21:10:22 -08:00
* 0.6.3 - Improve highlighting for MD020.
2017-11-22 21:45:56 -08:00
* 0.6.4 - Improve MD029/MD042, update dependencies.
2018-01-22 20:54:26 -08:00
* 0.7.0 - `resultVersion` defaults to 2 (breaking change), add MD045, improve MD029,
remove trimLeft/trimRight, split rules, refactor, update dependencies.
2018-03-10 21:46:52 -08:00
* 0.8.0 - Add support for using and authoring custom rules, improve MD004/MD007/MD013,
add `engines` to `package.json` , refactor, update dependencies.
2018-03-20 20:45:45 -07:00
* 0.8.1 - Update item loop to be iterative, improve MD014, update dependencies.
2018-05-13 16:41:59 -07:00
* 0.9.0 - Remove support for end-of-life Node versions 0.10/0.12/4, change "header" to
"heading" per spec (non-breaking), improve MD003/MD009/MD041, handle uncommon
line-break characters, refactor for ES6, update dependencies.
2018-05-27 21:25:40 -07:00
* 0.10.0 - Add support for non-JSON configuration files, pass file/string name to custom
rules, update dependencies.
2018-07-21 21:47:19 -07:00
* 0.11.0 - Improve MD005/MD024/MD029/MD038, improve custom rule example, add CONTRIBUTING.md,
update dependencies.
2019-02-03 21:40:05 -08:00
* 0.12.0 - Add `information` link for custom rules, `markdownItPlugins` for extensibility,
improve MD023/MD032/MD038, update dependencies.
2019-03-30 15:08:04 -07:00
* 0.13.0 - Improve MD013/MD022/MD025/MD029/MD031/MD032/MD037/MD041/, deprecate MD002,
improve pandoc YAML support, update dependencies.
2019-05-07 22:11:04 -07:00
* 0.14.0 - Remove support for end-of-life Node version 6, introduce `markdownlint-rule-helpers` ,
add MD046/MD047, improve MD033/MD034/MD039, improve custom rule validation and
in-browser demo, update dependencies.
2019-05-08 22:12:25 -07:00
* 0.14.1 - Improve MD033.
2019-05-18 13:36:06 -07:00
* 0.14.2 - Improve MD047, add `handleRuleFailures` option.
2019-06-09 16:51:41 -07:00
* 0.15.0 - Add `markdownlint-capture` /`markdownlint-restore` inline comments, improve
MD009/MD013/MD026/MD033/MD036, update dependencies.
2019-08-04 21:58:39 -07:00
* 0.16.0 - Add custom rule sample for linting code, improve MD026/MD031/MD033/MD038,
update dependencies.
2019-10-04 21:46:06 -07:00
* 0.17.0 - Add `resultVersion` 3 to support fix information for default and custom rules,
add fix information for 24 rules, update newline handling to match latest
CommonMark specification, improve MD014/MD037/MD039, update dependencies.
2019-10-19 17:55:10 -07:00
* 0.17.1 - Fix handling of front matter by fix information.
2019-10-24 20:23:22 -07:00
* 0.17.2 - Improve MD020/MD033/MD044.
2019-12-14 13:50:48 -08:00
* 0.18.0 - Add MD048/code-fence-style, add fix information for MD007/ul-indent, add
`markdownlint-disable-file` /`markdownlint-enable-file` inline comments, add
type declaration file (.d.ts) for TypeScript dependents, update schema, improve
MD006/MD007/MD009/MD013/MD030, update dependencies.
2020-01-27 19:19:34 -08:00
* 0.19.0 - Remove support for end-of-life Node version 8, add fix information for
MD005/list-indent, improve MD007/MD013/MD014, deprecate MD006/ul-start-left, add
rationale for every rule, update test runner and code coverage, add more JSDoc
comments, update dependencies.
2020-05-14 21:49:05 -07:00
* 0.20.0 - Add `markdownlint-configure-file` inline comment, reimplement MD037,
improve MD005/MD007/MD013/MD018/MD029/MD031/MD034/MD038/MD039, improve HTML
2020-04-11 13:54:46 -07:00
comment handling, update dependencies.
2020-04-12 20:48:04 -07:00
* 0.20.1 - Fix regression in MD037.
2020-04-25 21:15:13 -07:00
* 0.20.2 - Fix regression in MD037, improve MD038.
2020-05-14 21:49:05 -07:00
* 0.20.3 - Fix regression in MD037, improve MD044, add automatic regression testing.
2020-06-23 20:14:58 -07:00
* 0.20.4 - Fix regression in MD037, improve MD034/MD044, improve documentation.
2020-09-20 12:22:27 -07:00
* 0.21.0 - Lint concurrently for better performance (async only), add Promise-based APIs,
update TypeScript declaration file, hide `toString` on `LintResults` , add ability
to fix in browser demo, allow custom rules in `.markdownlint.json` schema, improve
MD042/MD044, improve documentation, update dependencies.
2020-10-20 20:16:49 -07:00
* 0.21.1 - Improve MD011/MD031, export `getVersion` API.
2020-11-24 16:49:12 -08:00
* 0.22.0 - Allow `extends` in config to reference installed packages by name, add
`markdownlint-disable-next-line` inline comment, support JSON front matter, improve
MD009/MD026/MD028/MD043, update dependencies (including `markdown-it` to v12).
2021-02-06 20:07:48 -08:00
* 0.23.0 - Add comprehensive example `.markdownlint.jsonc` /`.markdownlint.yaml` files, add fix
information for MD004/ul-style, improve MD018/MD019/MD020/MD021/MD037/MD041, improve
HTML comment handling, update test runner and test suite, update dependencies.
2021-02-11 22:35:16 -08:00
* 0.23.1 - Work around lack of webpack support for dynamic calls to `require` (`.resolve` ).
2021-08-22 22:35:50 -07:00
* 0.24.0 - Remove support for end-of-life Node version 10, add support for custom file system
module, improve MD010/MD011/MD037/MD043/MD044, improve TypeScript declaration file
and JSON schema, update dependencies.
2015-03-17 22:58:26 -07:00
[npm-image]: https://img.shields.io/npm/v/markdownlint.svg
[npm-url]: https://www.npmjs.com/package/markdownlint
[license-image]: https://img.shields.io/npm/l/markdownlint.svg
2016-10-05 22:50:21 -07:00
[license-url]: https://opensource.org/licenses/MIT