Directives Plugin
The directives plugin adds support for markdown directives, enabling you to create callouts, admonitions, and custom containers in your documentation.Features
- Container Directives - Multi-line content blocks
- Callout Support - Tip, note, warning, caution, danger, info
- Details/Summary - Collapsible content sections
- Custom Directives - Extensible for custom use cases
Configuration
The plugin is automatically enabled:packages/doom/src/plugins/directives/index.ts:6-13
Supported Directives
Callouts
Create attention-grabbing callout boxes:Rendered Output
:::tip This is a helpful tip for your users. ::: :::warning Be careful with this operation. ::: :::danger This action is dangerous and irreversible. :::Custom Titles
You can customize the title of any callout:Details/Summary
Create collapsible content sections:- Multiple paragraphs
- Code blocks
- Any markdown content :::
Callouts Container
Group multiple callouts together:Implementation
The plugin processes directives using the remark-directive library:packages/doom/src/plugins/directives/remark-directives.ts:6-15
Processing Logic
The plugin:- Visits all directive nodes in the markdown AST
- Checks if the directive is a recognized container type
- Applies appropriate styling and classes
- Converts unrecognized directives back to text
packages/doom/src/plugins/directives/remark-directives.ts:17-35
Directive Types
Markdown directives come in three types:Container Directives
Multi-line content blocks:Leaf Directives
Single-line blocks:Text Directives
Inline content:Styling
Callouts receive automatic styling through Doom’s global styles. You can customize them:Creating Custom Directives
To add custom directive support:- Fork the directives plugin
- Add your directive name to the recognized types
- Implement custom handling logic
Best Practices
- Use Semantic Types - Choose the right callout type for your message
- Custom Titles - Make titles descriptive and actionable
- Don’t Overuse - Too many callouts reduce their impact
- Consistent Style - Use similar callout types across your docs
- Accessible Content - Ensure callout content is readable