Skip to content

Commit

Permalink
Refactor API docs
Browse files Browse the repository at this point in the history
Refer to `vfile` for more up-to-date docs.

Related: why-jay/remark-lint-sentence-newline#2
  • Loading branch information
wooorm committed Sep 12, 2015
1 parent 8c8625f commit ad6df51
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.

0 comments on commit ad6df51

Please sign in to comment.