directive()

Support container directives with `:::name` syntax.

import { directive } from "@unifast/node";

Signature

function directive(): UnifastPlugin

Parameters

None.

Usage

import { compile, directive } from "@unifast/node";

const result = compile(md, { plugins: [directive()] });

Examples

Container directives

You can style these with CSS using the .directive-note, .directive-warning classes, similar to GitHub Alerts but with fully custom names.

Containers with attributes

:::warning title="Deprecation Notice"
This API will be removed in the next major version.
:::

Nested content

Directives support full Markdown inside, including lists, code blocks, and inline formatting.

:::note
You can include **bold**, *italic*, and other Markdown inside containers.

- List items work too
- As does `inline code`
:::