autolinkHeadings()
Automatically add anchor links to headings.
import { autolinkHeadings } from "@unifast/node";Signature
function autolinkHeadings(options?: AutolinkHeadingsOptions): UnifastPluginParameters
options?
Configuration for heading link behavior
| Property | Type | Default | Description |
|---|---|---|---|
behavior | "prepend" | "append" | "wrap" | "prepend" | Where to place the anchor link relative to the heading content |
Usage
import { compile, autolinkHeadings } from "@unifast/node";
const md = `# Introduction
## Getting Started
### Installation`;
const result = compile(md, {
plugins: [
autolinkHeadings({
behavior: "prepend", // "prepend" | "append" | "wrap"
}),
],
});