mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update README.md and CustomRules.md documentation of new fixInfo behavior.
This commit is contained in:
parent
33e3797084
commit
d974e78e3f
2 changed files with 11 additions and 6 deletions
|
@ -427,8 +427,9 @@ includes information about the line number, rule names, description, as well as
|
||||||
additional detail or context that is available. *This is the default.*
|
additional detail or context that is available. *This is the default.*
|
||||||
|
|
||||||
Passing a `resultVersion` of `3` corresponds to the detailed version `2` format
|
Passing a `resultVersion` of `3` corresponds to the detailed version `2` format
|
||||||
with additional information about fixes for certain errors. All errors for each
|
with additional information about how to fix automatically-fixable errors. In this
|
||||||
line are included (other versions collapse multiple errors for the same rule).
|
mode, all errors that occur on each line are reported (other versions report only
|
||||||
|
the first error for each rule).
|
||||||
|
|
||||||
##### options.markdownItPlugins
|
##### options.markdownItPlugins
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ A rule is implemented as an `Object` with four required properties:
|
||||||
- `function` is a synchronous `Function` that implements the rule and is passed two parameters:
|
- `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:
|
- `params` is an `Object` with properties that describe the content being analyzed:
|
||||||
- `name` is a `String` that identifies the input file/string.
|
- `name` is a `String` that identifies the input file/string.
|
||||||
- `tokens` is an `Array` of [`markdown-it` `Token` objects](https://markdown-it.github.io/markdown-it/#Token) with added `line` and `lineNumber` properties.
|
- `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.
|
- `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`).
|
- `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).
|
- `config` is an `Object` corresponding to the rule's entry in `options.config` (if present).
|
||||||
|
@ -52,11 +53,14 @@ A rule is implemented as an `Object` with four required properties:
|
||||||
- `details` is an optional `String` with information about what caused 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.
|
- `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.
|
- `range` is an optional `Array` with two `Number` values identifying the 1-based column and length of the error.
|
||||||
- `fixInfo` is an optional `Object` with information about how to fix the error:
|
- `fixInfo` is an optional `Object` with information about how to fix the error (all properties are optional, but
|
||||||
|
at least one of `deleteCount` and `insertText` should be present; when applying a fix, the delete should be
|
||||||
|
performed before the insert):
|
||||||
- `lineNumber` is an optional `Number` specifying the 1-based line number of the edit.
|
- `lineNumber` is an optional `Number` specifying the 1-based line number of the edit.
|
||||||
- `editColumn` is an optional `Number` specifying the 1-based column number of the edit.
|
- `editColumn` is an optional `Number` specifying the 1-based column number of the edit.
|
||||||
- `deleteCount` is an optional `Number` specifying the count of characters to delete with the edit.
|
- `deleteCount` is an optional `Number` specifying the count of characters to delete.
|
||||||
- `insertText` is an optional `String` specifying text to insert as part of the edit.
|
- `insertText` is an optional `String` specifying the text to insert. `\n` is the platform-independent way to add
|
||||||
|
a line break; line breaks should be added at the beginning of a line instead of at the end).
|
||||||
|
|
||||||
The collection of helper functions shared by the built-in rules is available for use by custom rules in the [markdownlint-rule-helpers package](https://www.npmjs.com/package/markdownlint-rule-helpers).
|
The collection of helper functions shared by the built-in rules is available for use by custom rules in the [markdownlint-rule-helpers package](https://www.npmjs.com/package/markdownlint-rule-helpers).
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue