Complete Guide to Admonitions
Master the use of admonitions (callout boxes) to enhance your blog posts with visual emphasis
What are Admonitions?
Admonitions are special callout boxes that help emphasize important information in your posts. They come in different types with distinct colors and icons to convey different types of messages.
Available Admonition Types
This blog supports 6 types of admonitions, each with a unique purpose and visual style.
Note (Blue)
Use for general information, tips, or supplementary details.
This is a note admonition. It’s perfect for providing additional context or highlighting interesting facts that supplement the main content.
Syntax:
:::note
Your note content here.
:::
Tip (Green)
Use for helpful suggestions, best practices, or pro tips.
This is a tip admonition. Use it to share helpful advice, shortcuts, or best practices that can improve the reader’s experience or workflow!
Syntax:
:::tip
Your tip content here.
:::
Info (Cyan)
Use for informational messages or FYI content.
This is an info admonition. Perfect for sharing factual information, definitions, or explanatory content that readers should know.
Syntax:
:::info
Your info content here.
:::
Warning (Orange)
Use for cautions, potential pitfalls, or things to watch out for.
This is a warning admonition. Use it to alert readers about potential issues, deprecated features, or situations that require caution.
Syntax:
:::warning
Your warning content here.
:::
Danger (Red)
Use for critical warnings, breaking changes, or severe issues.
This is a danger admonition. Reserve this for critical warnings, breaking changes, security issues, or scenarios that could cause serious problems.
Syntax:
:::danger
Your danger content here.
:::
Success (Green)
Use for confirmations, completed tasks, or positive outcomes.
This is a success admonition. Great for showing completion, success messages, or positive results!
Syntax:
:::success
Your success content here.
:::
Advanced Features
Custom Titles
You can customize the title of any admonition:
Custom Title
This note has a custom title instead of the default “Note”.
Syntax:
:::note[Custom Title]
Your content here.
:::
Multiple Paragraphs
Admonitions support multiple paragraphs and complex formatting:
This is the first paragraph with some bold text.
This is the second paragraph with italic text.
- List item 1
- List item 2
- List item 3
And even code blocks:
```javascript console.log(‘Hello from admonition!’); ```
Syntax:
:::tip
First paragraph.
Second paragraph.
- List items
- Work too
\`\`\`javascript
console.log('Code works!');
\`\`\`
:::
Collapsible Admonitions
All admonitions are collapsible by default! Click the title to expand/collapse the content.
Click the title above to see how this works! The content can be toggled on and off, making it easy to hide details until needed.
Use Cases & Examples
Documentation
API Version: This endpoint is available in API v2.0 and later.
Tutorials
Pro Tip: Always test your changes locally before deploying to production!
Warnings
Deprecated: This method will be removed in version 3.0. Please use the new newMethod() instead.
Critical Issues
Security Alert: Never commit API keys or sensitive credentials to version control!
Success Messages
Setup Complete: Your development environment is now ready to use!
Best Practices
When to Use Each Type
| Type | Use For | Examples |
|---|---|---|
| Note | General info, context | Background information, interesting facts |
| Tip | Helpful suggestions | Best practices, shortcuts, optimizations |
| Info | Factual information | Definitions, explanations, clarifications |
| Warning | Cautions | Potential issues, deprecations, gotchas |
| Danger | Critical warnings | Security issues, breaking changes, data loss |
| Success | Positive outcomes | Completions, achievements, confirmations |
Don’t Overuse
While admonitions are great for emphasis, using too many can make your content look cluttered and reduce their impact.
Good practice:
- Use 2-4 admonitions per post
- Only for truly important information
- Mix types appropriately
Bad practice:
- Using admonitions for every paragraph
- Multiple admonitions of the same type in a row
- Using the wrong type for the content
Keep Content Concise
Admonitions work best with concise, focused content. Keep them to 2-3 sentences when possible.
Styling & Appearance
Light Mode
All admonitions automatically adapt to light mode with appropriate colors:
- Soft, easy-on-the-eyes backgrounds
- Distinct border colors
- High contrast text
Dark Mode
In dark mode, admonitions use:
- Darker, muted backgrounds
- Brighter border colors for visibility
- Optimized text contrast
Icons
Each type has a unique Font Awesome icon:
- 💡 Note:
fa-lightbulb - 🔥 Tip:
fa-fire - ℹ️ Info:
fa-info-circle - ⚠️ Warning:
fa-exclamation-triangle - ⛔ Danger:
fa-exclamation-circle - ✅ Success:
fa-check-circle
Nesting & Combinations
Admonitions with Lists
You can include lists inside admonitions:
- First item
- Second item
- Third item
Or unordered lists:
- Item A
- Item B
- Item C
Admonitions with Code
Here’s how to install dependencies:
```bash npm install npm run dev ```
Don’t forget to check the logs for any errors!
Admonitions with Links
For more information, check out:
Common Mistakes
Wrong Syntax
❌ Wrong:
::note
Missing colon!
::
✅ Correct:
:::note
Three colons!
:::
Unclosed Admonitions
❌ Wrong:
:::warning
Missing closing tag
✅ Correct:
:::warning
Properly closed
:::
Incorrect Type Names
❌ Wrong:
:::error
Type doesn't exist
:::
✅ Correct:
:::danger
Use existing types
:::
Real-World Examples
Installation Instructions
Before You Start
Make sure you have Node.js 18+ installed on your system.
Breaking Changes
Breaking Change in v2.0
The oldMethod() has been completely removed. Update your code to use newMethod() before upgrading.
Feature Availability
New Feature
This feature is available starting from version 1.5.0.
Summary
You’ve learned everything about admonitions! Start using them in your posts to create engaging, well-structured content.
Quick Reference:
:::note- General information (Blue):::tip- Helpful suggestions (Green):::info- Factual information (Cyan):::warning- Cautions (Orange):::danger- Critical warnings (Red):::success- Positive outcomes (Green)
Happy writing! ✨
Comments
Comments are moderated and will be approved shortly.
Loading comments...
No comments yet. Be the first to comment!
Leave a comment
Insert GIF URL
Paste direct GIF URL from Giphy, Tenor, or any GIF site
Preview: