docs: Explain how to get an instance of Slugger (#2750)

This commit is contained in:
Paweł Grimm 2023-03-07 19:00:49 +01:00 committed by GitHub
parent f12568e5b8
commit 6164fb62c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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