Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update USING_PRO.md #3492

Merged
merged 4 commits into from
Oct 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update USING_PRO.md
  • Loading branch information
linuxbckp authored Oct 18, 2024
commit 2c95872f5e5374a059f4a20146064111960b9d28
25 changes: 0 additions & 25 deletions docs/USING_PRO.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,31 +250,6 @@ console.log(marked.parse('# heading 2\n\n## heading 3'));
<h3 id="heading-3">heading 3</h3>
```

If you want to add the walkTokens function everytime they open a file, you can create a new instance of Marked to ensure options and extensions are locally scoped.

```js
import { Marked } from 'marked';
const marked = new Marked();
// Override function
const walkTokens = (token) => {
if (token.type === 'heading') {
token.depth += 1;
}
};

marked.use({ walkTokens });

// Run marked
console.log(marked.parse('# heading 2\n\n## heading 3'));
```

**Output:**

```html
<h2 id="heading-2">heading 2</h2>
<h3 id="heading-3">heading 3</h3>
```

***

<h2 id="hooks">Hooks : <code>hooks</code></h2>
Expand Down