docs: Explain how to get an instance of Slugger
(#2750)
This commit is contained in:
parent
f12568e5b8
commit
6164fb62c0
@ -128,6 +128,13 @@ console.log(marked.parse('# heading+'));
|
||||
- <code>**image**(*string* href, *string* title, *string* text)</code>
|
||||
- <code>**text**(*string* text)</code>
|
||||
|
||||
`Slugger` is exposed from marked as `marked.Slugger`:
|
||||
|
||||
```js
|
||||
import { marked } from 'marked'
|
||||
const slugger = new marked.Slugger()
|
||||
```
|
||||
|
||||
`slugger` has the `slug` method to create a unique id from value:
|
||||
|
||||
```js
|
||||
|
Loading…
x
Reference in New Issue
Block a user