docusaurus-themes

mcclowes 的头像作者 mcclowes

在进行Docusaurus主题组件调整和编辑主题元素时使用

📖 中文导读:在进行Docusaurus主题组件调整和编辑主题元素时使用 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: docusaurus-themes

IMPORTANT: Keep description on ONE line for Claude Code compatibility

prettier-ignore

description: Use when swizzling Docusaurus theme components and editing theme elements

Docusaurus Swizzle

Quick Start

Swizzle components to customize Docusaurus theme behavior:

npm run swizzle @docusaurus/theme-classic ComponentName -- --wrap

Core Principles

  • Wrap (safe): Extends original component, easier to upgrade
  • Eject (unsafe): Full copy for maximum control, harder to maintain
  • Interactive mode: Use npm run swizzle to browse available components
  • Swizzled components go in src/theme/ComponentName/

Common Patterns

List available components:

npm run swizzle @docusaurus/theme-classic -- --list

Commonly swizzled: Footer, Navbar, DocItem, DocSidebar, TOC

Reference Files

For detailed documentation, see:

Notes

  • Prefer --wrap for minor changes to maintain upgrade compatibility
  • Test thoroughly after swizzling components
  • Check official docs for component-specific swizzle safety ratings