docs: remove slugger (#2984)

This commit is contained in:
Tony Brix 2023-09-14 13:20:54 -06:00 committed by GitHub
parent 998ba99848
commit ccd02296b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 32 deletions

View File

@ -115,7 +115,7 @@ marked.use({
- <code>**code**(*string* code, *string* infostring, *boolean* escaped)</code> - <code>**code**(*string* code, *string* infostring, *boolean* escaped)</code>
- <code>**blockquote**(*string* quote)</code> - <code>**blockquote**(*string* quote)</code>
- <code>**html**(*string* html, *boolean* block)</code> - <code>**html**(*string* html, *boolean* block)</code>
- <code>**heading**(*string* text, *number* level, *string* raw, *Slugger* slugger)</code> - <code>**heading**(*string* text, *number* level, *string* raw)</code>
- <code>**hr**()</code> - <code>**hr**()</code>
- <code>**list**(*string* body, *boolean* ordered, *number* start)</code> - <code>**list**(*string* body, *boolean* ordered, *number* start)</code>
- <code>**listitem**(*string* text, *boolean* task, *boolean* checked)</code> - <code>**listitem**(*string* text, *boolean* task, *boolean* checked)</code>
@ -136,36 +136,6 @@ marked.use({
- <code>**image**(*string* href, *string* title, *string* text)</code> - <code>**image**(*string* href, *string* title, *string* text)</code>
- <code>**text**(*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
slugger.slug('foo') // foo
slugger.slug('foo') // foo-1
slugger.slug('foo') // foo-2
slugger.slug('foo 1') // foo-1-1
slugger.slug('foo-1') // foo-1-2
...
```
`slugger.slug` can also be called with the `dryrun` option for stateless operation:
```js
slugger.slug('foo') // foo
slugger.slug('foo') // foo-1
slugger.slug('foo') // foo-2
slugger.slug('foo', { dryrun: true }) // foo-3
slugger.slug('foo', { dryrun: true }) // foo-3
slugger.slug('foo') // foo-3
slugger.slug('foo') // foo-4
...
```
`flags` has the following properties: `flags` has the following properties:
```js ```js

View File

@ -444,7 +444,7 @@ describe('use extension', () => {
} }
}, },
renderer: { renderer: {
heading(text, depth, raw, slugger) { heading(text, depth, raw) {
if (text === name) { if (text === name) {
return `<h${depth}>${text}</h${depth}>\n`; return `<h${depth}>${text}</h${depth}>\n`;
} }