NYC
skills/smithery/ai/docusaurus-plugins

docusaurus-plugins

SKILL.md

Docusaurus Plugin Guide

Quick Start

// Remark plugin - transforms markdown AST
module.exports = function remarkPlugin(options = {}) {
  return async function transformer(ast, vfile) {
    const { visit } = require('unist-util-visit');

    visit(ast, 'link', (node) => {
      // Transform nodes
      node.data = node.data || {};
      node.data.hProperties = { className: 'custom' };
    });

    return ast;
  };
};

// In docusaurus.config.js:
// remarkPlugins: [require('./plugins/my-plugin')]

Core Principles

  • 5 Plugin Types: Remark (markdown), Rehype (HTML), Lifecycle (routes/webpack), Theme (components), Content (custom data)
  • Remark: Transforms markdown before HTML conversion, use unist-util-visit for AST traversal
  • Rehype: Transforms HTML after compilation, processes HAST (HTML AST)
  • Lifecycle: Most flexible, implements hooks like loadContent(), contentLoaded(), postBuild()
  • Export function: Returns transformer (remark/rehype) or plugin object (lifecycle)

Reference Files

Detailed guides for each plugin type:

Weekly Installs
1
Repository
smithery/ai
First Seen
11 days ago
Installed on
claude-code1