Plugins
Anchor
This plugin adds id
attributes and permalinks to headings.
Installation
npm i @cartamd/plugin-anchor
Setup
Styles
Import the default theme, or create you own:
import '@cartamd/plugin-anchor/default.css';
Extension
<script>
import { Carta, MarkdownEditor } from 'carta-md';
import { anchor } from '@cartamd/plugin-anchor';
const carta = new Carta({
extensions: [anchor()]
});
</script>
<MarkdownEditor {carta} />
Options
Here are the options you can pass to anchor()
:
export interface AnchorExtensionOptions {
/**
* rehype-slug options.
*/
slug?: SlugOptions;
/**
* rehype-autolink-headings options.
*/
autolink?: AutolinkOptions;
}
Handmade by Davide