@anthonypena/marked-heading-links
v1.0.3
Published
Plugin to have link on every headings.
Downloads
7
Readme
@anthonypena/marked-heading-links
Install
npm i @anthonypena/marked-heading-links
Examples
Add the plugin to your Marked instance
import { markedHeadingLinks } from '@anthonypena/marked-heading-links';
import { Marked } from 'marked';
const marked = new Marked();
marked.use(markedHeadingLinks());
Transformation
From:
## Foo
to:
<h2 id="foo">Foo<a href="#foo" class="anchor" aria-label="permalink">🔗</a></h2>
Docs
Parameters
prefix
(optional): id prefix
Default: ''
linkClass
(optional): class to add to link
Default: 'anchor'
linkLabel
(optional): label of the link
Default: '🔗'
marked
(optional): a Marked instance
Default: new Marked instance