exmarkdown-heading-anchor
A svelte-exmarkdown plugin that places anchors in heading tags.
Demo
By using this plugin, convert Markdown as follows.
# Heading1
## Heading2
### Heading3
↓
<h1 id="Heading1">Heading1</h1>
<h2 id="Heading2">Heading2</h2>
<h3 id="Heading3">Heading3</h2>
Install
npm i exmarkdown-heading-anchor
Example
<script>
import { headingAnchor } from 'exmarkdown-heading-anchor'
import { Markdown } from 'svelte-exmarkdown'
// ...
</script>
<Markdown
md={/*...*/}
plugins={[
// ...
headingAnchor({
// Configuration (optional)
})
]}
/>
Plugin Config Types
Known limitations
The attribute is added when the component is mounted, so the HTML rendered server-side does not have an id attribute.