Skip to content

Commit 19b1889

Browse files
committed
Add docs for messages
1 parent d95ff21 commit 19b1889

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

readme.md

+27-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ retext()
3636
Yields:
3737

3838
```txt
39-
1:6-1:12 warning `useles` is misspelt; did you mean `useless`? retext-spell retext-spell
40-
1:13-1:22 warning `documeant` is misspelt; did you mean `document`? retext-spell retext-spell
39+
1:6-1:12 warning `useles` is misspelt; did you mean `useless`? useles retext-spell
40+
1:13-1:22 warning `documeant` is misspelt; did you mean `document`? documeant retext-spell
4141
4242
⚠ 2 warnings
4343
```
@@ -92,6 +92,27 @@ By default, up to thirty words are suggested for.
9292
Further misspellings are still warned about, but without suggestions.
9393
Increasing this number significantly impacts performance.
9494

95+
### Messages
96+
97+
Each message is emitted as a [`VFileMessage`][message] on `file`, with the
98+
following fields:
99+
100+
###### `message.source`
101+
102+
Name of this plugin (`'retext-spell'`).
103+
104+
###### `message.ruleId`
105+
106+
Normalized not ok word (`string`, such as `'useles'`).
107+
108+
###### `message.actual`
109+
110+
Current not ok word (`string`, such as `'Useles'`).
111+
112+
###### `message.expected`
113+
114+
List of suggestions of words to use (`Array.<string>`, such as `['Useless']`).
115+
95116
## Related
96117

97118
* [`retext-contractions`](https://github.com/retextjs/retext-contractions)
@@ -167,12 +188,14 @@ abide by its terms.
167188

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

191+
[message]: https://github.com/vfile/vfile-message
192+
193+
[literal]: https://github.com/syntax-tree/nlcst-is-literal#isliteralparent-index
194+
170195
[process]: https://github.com/unifiedjs/unified#processorprocessfilevalue-done
171196

172197
[dictionaries]: https://github.com/wooorm/dictionaries
173198

174199
[nspell]: https://github.com/wooorm/nspell
175200

176-
[literal]: https://github.com/syntax-tree/nlcst-is-literal#isliteralparent-index
177-
178201
[personal]: https://github.com/wooorm/nspell#personal-dictionary-documents

0 commit comments

Comments
 (0)