|
18 | 18 | npm install mdast-util-heading-style
|
19 | 19 | ```
|
20 | 20 |
|
21 |
| -## Usage |
| 21 | +## Use |
22 | 22 |
|
23 | 23 | ```js
|
24 | 24 | var style = require('mdast-util-heading-style')
|
25 |
| -var remark = require('remark')() |
| 25 | +var unified = require('unified') |
| 26 | +var parse = require('remark-parse') |
26 | 27 |
|
27 |
| -style(remark.parse('# ATX').children[0]) // => 'atx' |
28 |
| -style(remark.parse('# ATX #\n').children[0]) // => 'atx-closed' |
29 |
| -style(remark.parse('ATX\n===').children[0]) // => 'setext' |
| 28 | +var processor = unified().use(parse) |
30 | 29 |
|
31 |
| -style(remark.parse('### ATX').children[0]) // => null |
32 |
| -style(remark.parse('### ATX').children[0], 'setext') // => 'setext' |
| 30 | +style(processor.parse('# ATX').children[0]) // => 'atx' |
| 31 | +style(processor.parse('# ATX #\n').children[0]) // => 'atx-closed' |
| 32 | +style(processor.parse('ATX\n===').children[0]) // => 'setext' |
| 33 | + |
| 34 | +style(processor.parse('### ATX').children[0]) // => null |
| 35 | +style(processor.parse('### ATX').children[0], 'setext') // => 'setext' |
33 | 36 | ```
|
34 | 37 |
|
35 | 38 | ## API
|
@@ -60,8 +63,8 @@ See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
|
60 | 63 | started.
|
61 | 64 | See [`support.md`][support] for ways to get help.
|
62 | 65 |
|
63 |
| -This project has a [Code of Conduct][coc]. |
64 |
| -By interacting with this repository, organisation, or community you agree to |
| 66 | +This project has a [code of conduct][coc]. |
| 67 | +By interacting with this repository, organization, or community you agree to |
65 | 68 | abide by its terms.
|
66 | 69 |
|
67 | 70 | ## License
|
@@ -92,7 +95,7 @@ abide by its terms.
|
92 | 95 |
|
93 | 96 | [collective]: https://opencollective.com/unified
|
94 | 97 |
|
95 |
| -[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg |
| 98 | +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg |
96 | 99 |
|
97 | 100 | [chat]: https://spectrum.chat/unified/syntax-tree
|
98 | 101 |
|
|
0 commit comments