Plugins

Ariadocs uses remark and rehype plugins for MDX processing.

Import Plugins

import {
  remarkGfm,
  rehypePrism,
  rehypeAutolinkHeadings,
  rehypeSlug,
  rehypeCodeTitles,
  rehypeCodeRaw,
} from "@ariadocs/react/plugins";

Plugin Order

Order matters! Use this sequence:

export const docsConfig: DocsConfig = {
  rehypePlugins: [
    rehypeCodeRaw, // 1. Extract raw code
    rehypeCodeTitles, // 2. Code block titles
    rehypePrism, // 3. Syntax highlighting
    rehypeSlug, // 4. Add IDs to headings
    rehypeAutolinkHeadings, // 5. Link to headings
  ],
  remarkPlugins: [
    remarkGfm, // GitHub Flavored Markdown
  ],
};

Plugin Descriptions

PluginTypeDescription
remarkGfmremarkGFM support (tables, strikethrough, task lists)
rehypePrismrehypeSyntax highlighting for code blocks
rehypeSlugrehypeAdd id attributes to headings
rehypeAutolinkHeadingsrehypeAdd anchor links to headings
rehypeCodeTitlesrehypeAdd titles/filenames to code blocks
rehypeCodeRawrehypeInject raw code into <pre> for copy functionality

Custom Plugins

Add any remark/rehype plugin:

import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";

export const docsConfig: DocsConfig = {
  remarkPlugins: [remarkGfm, remarkMath],
  rehypePlugins: [rehypeSlug, rehypeKatex],
};