From ad6df51f045d62cc7769b4a99099b0870575f713 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sat, 12 Sep 2015 19:04:51 +0200 Subject: [PATCH] Refactor API docs Refer to `vfile` for more up-to-date docs. Related: chcokr/mdast-lint-sentence-newline#2 --- doc/api.md | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/doc/api.md b/doc/api.md index 5c7e6baf..08665a68 100644 --- a/doc/api.md +++ b/doc/api.md @@ -21,7 +21,7 @@ var doc = '* Hello\n' + Process. ```javascript -processor.process(doc, function (err, res, file) { +processor.process(doc, function (err, file, res) { var messages = file.messages; /** * Yields: @@ -68,37 +68,5 @@ look as follows: } ``` -These messages comply to two schema’s. First, they’re valid error objects, -so they can be thrown (while still looking :ok_hand:, due to `Error#toString()` -magic), secondly the `file` object itself can be passed to ESLint’s formatters: - -```javascript -var compact = require('eslint/lib/formatters/compact'); -var mdast = require('mdast'); -var lint = require('mdast-lint'); - -// For example purposes were processing `example.md` as seen above. -mdast().use(lint).process(doc, function (err, res, file) { - compact([file]); - /** - * line 3, col 1, Warning - Invalid ordered list item marker: should be `*` - * - * 1 problem - */ -}); -``` - -Each message contains the following properties: - -* `fatal` (`boolean?`) — Always `false`; - -* `reason` (`string`) — Warning message; - -* `line` (`number`) — Starting line (1-based); - -* `column` (`number`) — Starting column of exception (1-based). - -* `file` (`string`) — File path of exception. - -* `ruleId` (`string`) — Name of the rule which triggered this warning, - useful when looking for how to turn the darn thing off. +See [`VFileMessage`](https://github.com/wooorm/vfile#vfilemessage) for more +information.