Formatting directives provide styled components for badges, buttons, step-by-step guides, and more.
Key Terms
- Badge
- A small styled label for tags, status indicators, or labels. Renders as an inline element with customizable CSS classes.
- Button
- A styled link element that appears as a button. Supports colors, sizes, icons, and link targets for calls-to-action.
- Steps Container
- A container directive (
{steps}) that groups multiple step directives together. Requires 4 fences minimum (::::). - Step
- An individual step directive (
{step}) within a steps container. Contains content for one step in a sequential guide. - Checklist
- A styled container for bullet lists and task lists. Provides visual styling for prerequisites, requirements, or task tracking.
- Rubric
- A pseudo-heading that looks like a heading but doesn't appear in the table of contents. Perfect for API documentation section labels.
- List Table
- A table created from nested lists, avoiding pipe character conflicts in type annotations. Useful for Python type hints and complex data structures.
Badge
Create styled badges for labels, tags, or status indicators.
Syntax:
1 2 3 | |
Options:
:class:- CSS classes (default:badge badge-secondary)
Alias:{bdg}(Sphinx-Design compatibility)
Examples
Basic Badge:
1 2 | |
Custom Class:
1 2 3 | |
CLI Command Badge:
1 2 3 | |
Button
Create styled link buttons for calls-to-action.
Syntax:
1 2 3 4 5 6 7 8 9 | |
Options:
:color:- Color:primary(default),secondary,success,danger,warning,info,light,dark:style:- Style:default(rounded),pill(fully rounded),outline:size:- Size:small,medium(default),large:icon:- Icon name (same as cards):target:- Link target (e.g.,_blankfor external links)
Examples
Basic Button:
1 2 3 | |
Primary CTA:
1 2 3 4 5 6 7 | |
External Link:
1 2 3 4 5 6 | |
Steps
Create visual step-by-step guides using named closers for clean, readable syntax.
Steps Container ({steps})
Container for multiple steps. Use:::{/steps}to close.
Syntax:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Options:
:class:- Custom CSS class:style:- Style:default,compact
Individual Step ({step})
Single step within a steps container. Use:::{/step}to close.
Syntax:
1 2 3 4 5 | |
Options:
:class:- Custom CSS class
Examples
Basic Steps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Steps with Nested Admonitions:
Named closers eliminate fence-counting for complex nesting:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Note: Named closers (:::{/name}) explicitly close directives, making deeply nested content readable without counting colons.
Checklist
Create styled checklist containers for bullet lists and task lists.
Syntax:
1 2 3 4 5 6 | |
Options:
- Title (optional) - Checklist title
Examples
Basic Checklist:
1 2 3 4 5 | |
Task List:
1 2 3 4 5 | |
Rubric
Create pseudo-headings that look like headings but don't appear in the table of contents. Perfect for API documentation labels.
Syntax:
1 2 3 | |
Options:
:class:- Custom CSS class
Note: Rubrics don't contain content - they're label-only directives. Content after the rubric is separate markdown.
Examples
API Documentation:
1 2 3 4 5 6 7 8 9 10 11 12 | |
List Table
Create tables from nested lists (avoids pipe character issues in type annotations).
Syntax:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Options:
:header-rows:- Number of header rows (default: 0):widths:- Space-separated column widths (percentages):class:- CSS class
Examples
Basic Table:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
With Column Widths:
1 2 3 4 5 6 7 8 9 10 11 | |
Best Practices
- Badges: Use for labels, tags, or status indicators
- Buttons: Use for primary calls-to-action
- Steps: Use for sequential instructions or tutorials
- Checklists: Use for prerequisites, requirements, or task lists
- Rubrics: Use for API documentation section labels
- List Tables: Use when pipe characters conflict with code syntax
Related
- Icon Reference - SVG icons for content and templates
- Layout Directives - Cards, tabs, dropdowns
- Admonitions - Callout boxes