In addition to its built-in rules, `markdownlint` lets you enhance the linting experience by passing a list of custom rules using the [`options.customRules` property](../README.md#optionscustomrules).
Custom rules can do everything the built-in rules can and are defined inline or imported from another package (keyword `markdownlint-rules` on [npm](https://www.npmjs.com/)).
Custom rules can be disabled, enabled, and customized using the same syntax as built-in rules.
## Authoring
Rules are defined by a name (or multiple names), a description, one or more tags, and a function that implements the rule's behavior.
That function is called once for each file/string input and is passed the parsed input and a function to log any violations.
A simple rule implementation looks like:
```js
module.exports = {
"names": [ "any-blockquote" ],
"description": "Rule that reports an error for any blockquote",
A rule is implemented as an `Object` with four required properties:
-`names` is an `Array` of `String` values that identify the rule in output messages and config.
-`description` is a `String` value that describes the rule in output messages.
-`tags` is an `Array` of `String` values that groups related rules for easier customization.
-`function` is a synchronous `Function` that implements the rule and is passed two parameters:
-`params` is an `Object` with properties that describe the content being analyzed:
-`tokens` is an `Array` of [`markdown-it` `Token` objects](https://markdown-it.github.io/markdown-it/#Token) with added `line` and `lineNumber` properties.
-`lines` is an `Array` of `String` values corresponding to the lines of the input file/string.
-`frontMatterLines` is an `Array` of `String` values corresponding to any front matter (not present in `lines`).
-`config` is an `Object` corresponding to the rule's entry in `options.config` (if present).
-`onError` is a function that takes a single `Object` parameter with one required and three optional properties:
-`lineNumber` is a required `Number` specifying the 1-based line number of the error.
-`details` is an optional `String` with information about what caused the error.
-`context` is an optional `String` with relevant text surrounding the error location.
-`range` is an optional `Array` with two `Number` values identifying the 1-based column and length of the error.
## Examples
- [Simple rules used by the project's test cases](../test/rules)
- Includes [sample package configuration for npm](../test/rules/package.json)
- [Code for all `markdownlint` built-in rules](../lib)
## References
- [CommonMark documentation and specification](http://commonmark.org/)