Skip to content

Commit

Permalink
docs: remove slugger (#2984)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech authored Sep 14, 2023
1 parent 998ba99 commit ccd0229
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
32 changes: 1 addition & 31 deletions docs/USING_PRO.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ marked.use({
- <code>**code**(*string* code, *string* infostring, *boolean* escaped)</code>
- <code>**blockquote**(*string* quote)</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>**list**(*string* body, *boolean* ordered, *number* start)</code>
- <code>**listitem**(*string* text, *boolean* task, *boolean* checked)</code>
Expand All @@ -136,36 +136,6 @@ marked.use({
- <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
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:

```js
Expand Down
2 changes: 1 addition & 1 deletion test/unit/marked-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ describe('use extension', () => {
}
},
renderer: {
heading(text, depth, raw, slugger) {
heading(text, depth, raw) {
if (text === name) {
return `<h${depth}>${text}</h${depth}>\n`;
}
Expand Down

1 comment on commit ccd0229

@vercel
Copy link

@vercel vercel bot commented on ccd0229 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.