Skip to content

Commit

Permalink
Add docs for messages
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 7, 2019
1 parent b1cbd84 commit 640dccb
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Yields:

```txt
example.txt
3:14-3:16 warning Expected `1` space between sentences, not `2` retext-sentence-spacing retext-sentence-spacing
3:14-3:16 warning Expected `1` space between sentences, not `2` space retext-sentence-spacing
⚠ 1 warning
```
Expand All @@ -65,7 +65,7 @@ Yields:

```txt
example.txt
1:14-1:15 warning Expected `2` spaces between sentences, not `1` retext-sentence-spacing retext-sentence-spacing
1:14-1:15 warning Expected `2` spaces between sentences, not `1` double-space retext-sentence-spacing
⚠ 1 warning
```
Expand All @@ -83,6 +83,27 @@ Emit warnings when the spacing does not adhere to the preferred style.
* `1` (or `'space'`, default) — Allow only one space between sentences
* `2` — Allow only two spaces between sentences

### Messages

Each message is emitted as a [`VFileMessage`][message] on `file`, with the
following fields:

###### `message.source`

Name of this plugin (`'retext-sentence-spacing'`).

###### `message.ruleId`

Preferred style (`'newline'`, `'space'`, or `'double-space'`).

###### `message.actual`

Current not ok spacing (`string`, such as `' '`).

###### `message.expected`

List of suggestions of spacing to use (`Array.<string>`, such as `['\n']`).

## Related

* [`retext-contractions`](https://github.com/retextjs/retext-contractions)
Expand Down Expand Up @@ -149,3 +170,5 @@ abide by its terms.
[author]: https://wooorm.com

[retext]: https://github.com/retextjs/retext

[message]: https://github.com/vfile/vfile-message

0 comments on commit 640dccb

Please sign in to comment.