Skip to content

Commit 149a4a1

Browse files
committedJun 13, 2016
Update docs
1 parent 8aa2d2c commit 149a4a1

File tree

5 files changed

+114
-149
lines changed

5 files changed

+114
-149
lines changed
 

‎.remarkrc

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"output": true,
3-
"plugins": [
4-
"comment-config",
5-
"github",
6-
"toc",
7-
"./",
8-
"validate-links"
9-
],
3+
"plugins": {
4+
"comment-config": null,
5+
"github": null,
6+
"toc": {
7+
"tight": true
8+
},
9+
"./": {
10+
"no-missing-blank-lines": false
11+
},
12+
"validate-links": null
13+
},
1014
"settings": {
1115
"bullet": "*"
1216
}

‎doc/api.md

-72
This file was deleted.
File renamed without changes.

‎doc/rules.md

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ See the readme for a [list of external rules](https://github.com/wooorm/remark-l
99
## Table of Contents
1010

1111
* [Rules](#rules)
12-
1312
* [external](#external)
1413
* [reset](#reset)
1514
* [blockquote-indentation](#blockquote-indentation)

‎readme.md

+103-69
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
# ![remark-lint][logo]
22

3-
[![Build Status][travis-badge]][travis-ci]
4-
[![Coverage Status][coverage-badge]][coverage-ci]
3+
[![Build Status][build-badge]][build-status]
4+
[![Coverage Status][coverage-badge]][coverage-status]
5+
[![Chat][chat-badge]][chat]
6+
7+
<!--lint disable list-item-spacing-->
58

69
**remark-lint** is a markdown code style linter. Another linter? Yes.
710
Ensuring the markdown you (and contributors) write is of great quality will
811
provide better rendering in all the different markdown parsers, and makes
9-
sure less refactoring is needed afterwards. What is quality? That’s up to you,
12+
sure less refactoring is needed afterwards. What is quality? That’s up to you,
1013
but the defaults are sensible :ok_hand:.
1114

12-
**remark-lint** has lots of tests. Supports Node, io.js, and the browser.
13-
100% coverage. 50+ rules. It’s built on [**remark**][remark],
14-
a powerful markdown processor powered by [plugins][remark-plugins]
15-
(such as this one).
15+
**remark-lint** is built on [**remark**][remark], a powerful markdown
16+
processor powered by [plugins][remark-plugins] (such as this one).
1617

1718
## Table of Contents
1819

1920
* [Installation](#installation)
2021
* [Command line](#command-line)
2122
* [Programmatic](#programmatic)
23+
* [remark.use(lint\[, options\])](#remarkuselint-options)
2224
* [Rules](#rules)
2325
* [Configuring remark-lint](#configuring-remark-lint)
2426
* [Using remark to fix your markdown](#using-remark-to-fix-your-markdown)
@@ -29,7 +31,7 @@ a powerful markdown processor powered by [plugins][remark-plugins]
2931

3032
## Installation
3133

32-
[npm][npm-install]:
34+
[npm][]:
3335

3436
```bash
3537
npm install remark-lint
@@ -42,10 +44,10 @@ module, [uncompressed and compressed][releases].
4244

4345
![Example of how remark-lint looks on screen][screenshot]
4446

45-
Use remark-lint together with remark:
47+
Use `remark-lint` together with [`remark-cli`][cli]:
4648

4749
```bash
48-
npm install --global remark remark-lint
50+
npm install --global remark-cli remark-lint
4951
```
5052

5153
Let’s say `example.md` looks as follows:
@@ -56,27 +58,69 @@ Let’s say `example.md` looks as follows:
5658
[World][]
5759
```
5860

59-
Then, to run **remark-lint** on `example.md`:
61+
Now, running `remark example.md -u remark-lint` yields:
6062

61-
```bash
62-
remark example.md -u remark-lint
63-
#
64-
# Yields:
65-
#
66-
# example.md
67-
# 1:3 warning Incorrect list-item indent: add 2 spaces list-item-indent
68-
# 3:1-3:10 warning Found reference to undefined definition no-undefined-references
69-
#
70-
# ⚠ 2 warnings
63+
```txt
64+
example.md
65+
1:3 warning Incorrect list-item indent: add 2 spaces list-item-indent
66+
3:1-3:10 warning Found reference to undefined definition no-undefined-references
67+
⚠ 2 warnings
7168
```
7269

7370
See [`doc/rules.md`][rules] for what those warnings are (and how to
7471
turn them off).
7572

7673
## Programmatic
7774

78-
[`doc/api.md`][api] describes how to use **remark-lint**’s
79-
programatic interface in JavaScript.
75+
Use `remark-lint` together with [`remark`][api]:
76+
77+
```bash
78+
npm install remark remark-lint
79+
```
80+
81+
Let’s say `example.js` looks as follows:
82+
83+
```js
84+
var report = require('vfile-reporter');
85+
var remark = require('remark');
86+
var lint = require('remark-lint');
87+
88+
var file = remark().use(lint).process('## Hello world!');
89+
90+
console.log(report(file));
91+
```
92+
93+
Now, running `node example.js` yields:
94+
95+
```txt
96+
<stdin>
97+
1:1 warning Missing newline character at end of file final-newline
98+
1:1-1:16 warning First heading level should be `1` first-heading-level
99+
1:1-1:16 warning Don’t add a trailing `!` to headings no-heading-punctuation
100+
101+
⚠ 3 warnings
102+
```
103+
104+
### `remark.use(lint[, options])`
105+
106+
Adds warnings for style violations to the processed [virtual file][vfile].
107+
108+
When processing a file, these warnings are available at `file.messages`, and
109+
look as follows:
110+
111+
```js
112+
{
113+
file: '~/example.md',
114+
reason: 'First heading level should be `1`',
115+
line: 1,
116+
column: 1,
117+
location: Position { start: [Object], end: [Object] },
118+
ruleId: 'first-heading-level',
119+
fatal: false,
120+
source: 'remark-lint' }
121+
```
122+
123+
See [`VFileMessage`][vfile-message] for more information.
80124

81125
## Rules
82126

@@ -85,31 +129,25 @@ for, examples of markdown they warn for, and how to fix their warnings.
85129

86130
## Configuring remark-lint
87131

88-
**remark-lint** is just a **remark** plug-in. Meaning, you can opt to
89-
configure using configuration files. Read more about these files
90-
(`.remarkrc` or `package.json`) in [**remark**’s docs][remarkrc].
132+
**remark-lint** is a **remark** plug-in and supports configuration
133+
through its [configuration files][cli].
91134

92135
An example `.remarkrc` file could look as follows:
93136

94137
```json
95138
{
96139
"plugins": {
97-
"lint": {
140+
"remark-lint": {
98141
"no-multiple-toplevel-headings": false,
99142
"list-item-indent": false,
100143
"maximum-line-length": 79
101144
}
102-
},
103-
"settings": {
104-
"commonmark": true
105145
}
106146
}
107147
```
108148

109-
Where the object at `plugins.lint` is a map of `ruleId`s and their values. The
110-
object at `settings` determines how **remark** parses (and compiles)
111-
markdown code. Read more about the latter on
112-
[**remark**’s readme][remark-process].
149+
Where the object at `plugins['remark-lint']` is a map of `ruleId`s and
150+
their values.
113151

114152
Using our `example.md` from before:
115153

@@ -119,24 +157,20 @@ Using our `example.md` from before:
119157
[World][]
120158
```
121159

122-
We now run the below command _without_ the `-u remark-lint` since
123-
our `.remarkrc` includes the lint plugin.
160+
Now, running `remark example.md` (**without `-u remark-lint`** since
161+
our `.remarkrc` includes the lint plugin) yields:
124162

125163
```bash
126-
remark example.md
127-
#
128-
# Yields:
129-
#
130-
# example.md
131-
# 3:1-3:10 warning Found reference to undefined definition no-undefined-references
132-
#
133-
# ⚠ 2 warnings
164+
example.md
165+
3:1-3:10 warning Found reference to undefined definition no-undefined-references
166+
167+
⚠ 2 warnings
134168
```
135169

136170
In addition, you can also provide configuration comments to turn a rule
137-
on or off inside a file. Note that you cannot change what a setting,
138-
such as `maximum-line-length`, checks for, as you’re either enabling
139-
or disabling warnings). Read more about configuration comments in
171+
on or off inside a file. Note that you cannot change what a setting,
172+
such as `maximum-line-length`, just whether they are shown or not.
173+
Read more about configuration comments in
140174
[**remark-message-control**][message-control]s documentation.
141175

142176
The following file will warn twice for the duplicate headings:
@@ -167,7 +201,7 @@ but the third is re-enabled):
167201
## Using remark to fix your markdown
168202

169203
One of **remark**’s cool parts is that it compiles to very clean, and highly
170-
cross-vendor supported markdown. It’ll ensure list items use a single bullet,
204+
cross-vendor supported markdown. It’ll ensure list items use a single bullet,
171205
emphasis and strong use a standard marker, and that your table fences are
172206
aligned.
173207

@@ -179,7 +213,7 @@ and I strongly suggest checking out how it can make your life easier :+1:
179213
Currently, **remark-lint** is integrated with Atom through
180214
[**linter-markdown**][linter-markdown].
181215

182-
I’m very interested in more integrations. Let me know if I can help.
216+
I’m very interested in more integrations. Let me know if I can help.
183217

184218
## List of External Rules
185219

@@ -190,23 +224,17 @@ excluding `remark-lint-no-` or `remark-lint-`
190224

191225
* [`vhf/remark-lint-alphabetize-lists`](https://github.com/vhf/remark-lint-alphabetize-lists)
192226
— Ensure list items are in alphabetical order;
193-
194227
* [`vhf/remark-lint-blank-lines-1-0-2`](https://github.com/vhf/remark-lint-blank-lines-1-0-2)
195228
— Ensure a specific number of lines between blocks;
196-
197229
* [`vhf/remark-lint-books-links`](https://github.com/vhf/remark-lint-books-links)
198230
— Ensure links in lists of books follow a standard format;
199-
200231
* [`Qard/remark-lint-code`](https://github.com/Qard/remark-lint-code)
201232
— Lint fenced code blocks by corresponding language tags,
202233
currently supporting [ESLint](https://github.com/Qard/remark-lint-code-eslint).
203-
204234
* [`vhf/remark-lint-no-empty-sections`](https://github.com/vhf/remark-lint-no-empty-sections)
205235
— Ensure every heading is followed by content (forming a section);
206-
207236
* [`chcokr/remark-lint-sentence-newline`](https://github.com/chcokr/remark-lint-sentence-newline)
208237
— Ensure sentences are followed by a newline;
209-
210238
* [`vhf/remark-lint-no-url-trailing-slash`](https://github.com/vhf/remark-lint-no-url-trailing-slash)
211239
— Ensure that the `href` of links has no trailing slash.
212240

@@ -221,38 +249,44 @@ excluding `remark-lint-no-` or `remark-lint-`
221249

222250
<!-- Definitions -->
223251

224-
[travis-badge]: https://img.shields.io/travis/wooorm/remark-lint.svg
252+
[build-badge]: https://img.shields.io/travis/wooorm/remark-inline-links.svg
253+
254+
[build-status]: https://travis-ci.org/wooorm/remark-inline-links
225255

226-
[travis-ci]: https://travis-ci.org/wooorm/remark-lint
256+
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark-inline-links.svg
227257

228-
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark-lint.svg
258+
[coverage-status]: https://codecov.io/github/wooorm/remark-inline-links
229259

230-
[coverage-ci]: https://codecov.io/github/wooorm/remark-lint
260+
[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg
231261

232-
[npm-install]: https://docs.npmjs.com/cli/install
262+
[chat]: https://gitter.im/wooorm/remark
233263

234-
[releases]: https://github.com/wooorm/remark-lint/releases
264+
[releases]: https://github.com/wooorm/remark-inline-links/releases
265+
266+
[license]: LICENSE
235267

236268
[author]: http://wooorm.com
237269

270+
[npm]: https://docs.npmjs.com/cli/install
271+
272+
[remark]: https://github.com/wooorm/remark
273+
238274
[logo]: https://cdn.rawgit.com/wooorm/remark-lint/master/logo.svg
239275

240276
[screenshot]: https://cdn.rawgit.com/wooorm/remark-lint/master/screenshot.png
241277

242278
[rules]: doc/rules.md
243279

244-
[api]: doc/api.md
245-
246-
[license]: LICENSE
280+
[api]: https://github.com/wooorm/remark/tree/master/packages/remark
247281

248-
[remark]: https://github.com/wooorm/remark
282+
[cli]: https://github.com/wooorm/remark/tree/master/packages/remark-cli
249283

250284
[remark-plugins]: https://github.com/wooorm/remark/blob/master/doc/plugins.md
251285

252-
[remarkrc]: https://github.com/wooorm/remark/blob/master/doc/remarkrc.5.md
253-
254-
[remark-process]: https://github.com/wooorm/remark#remarkprocessvalue-options-done
255-
256286
[linter-markdown]: https://atom.io/packages/linter-markdown
257287

258288
[message-control]: https://github.com/wooorm/remark-message-control#markers
289+
290+
[vfile]: https://github.com/wooorm/vfile
291+
292+
[vfile-message]: https://github.com/wooorm/vfile#vfilemessage

0 commit comments

Comments
 (0)
Please sign in to comment.