Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 5, 2021
1 parent 88c1516 commit 5d32ff0
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ No change is needed: it works exactly the same now as it did before!

## Install

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.

[npm][]:

```sh
Expand All @@ -34,17 +37,19 @@ Say we have the following file, `example.md`:
Something nondescript.
```

And our script, `example.js`, looks as follows:
And our module, `example.js`, looks as follows:

```js
var fs = require('fs')
var remark = require('remark')
var license = require('remark-license')
import fs from 'node:fs'
import {remark} from 'remark'
import remarkLicense from 'remark-license'

const buf = fs.readFileSync('example.md')

remark()
.use(license)
.process(fs.readFileSync('example.md'), function(err, file) {
if (err) throw err
.use(remarkLicense)
.process(buf)
.then((file) => {
console.log(String(file))
})
```
Expand All @@ -59,7 +64,10 @@ Now, running `node example` yields:

## API

### `remark().use(license[, options])`
This package exports no identifiers.
The default export is `remarkLicense`.

### `unified().use(remarkLicense[, options])`

Plugin to add a license section to your readme.
Adds content to the heading matching `/^licen[cs]e$/i` or `options.heading`.
Expand Down

0 comments on commit 5d32ff0

Please sign in to comment.