113 lines
3.6 KiB
Markdown
113 lines
3.6 KiB
Markdown
## Basic syntax
|
||
|
||
Admonitions use *fenced code blocks* whose language is `ad-<type>`.
|
||
Everything inside is the content of the admonition.
|
||
|
||
```ad-note
|
||
title: Optional Title Here
|
||
collapse: open|close|none ← (optional) how it starts
|
||
This is the body content of your admonition.
|
||
You can write Markdown inside.
|
||
```
|
||
|
||
- The `title:` field is optional. If omitted, it uses the default title for that type (e.g. “Note” for `ad-note`). :contentReference[oaicite:0]{index=0}
|
||
- The `collapse:` field controls whether the admonition starts open or closed. Options: `open`, `close`, or `none` (no collapsing). :contentReference[oaicite:1]{index=1}
|
||
|
||
---
|
||
|
||
## ✅ Default types
|
||
|
||
Here are some of the built-in types (i.e. the `type` part after `ad-`) that you’ll commonly use (with default behaviors/icons):
|
||
|
||
- ad-note
|
||
- ad-info
|
||
- ad-tip
|
||
- ad-warning
|
||
- ad-caution / ad-attention
|
||
- ad-danger / ad-error
|
||
- ad-success
|
||
- ad-example
|
||
- ad-question / ad-help
|
||
- ad-abstract / ad-summary / ad-tldr
|
||
- ad-failure / ad-fail / ad-missing
|
||
- ad-bug
|
||
|
||
(Yes, there are synonyms and variants. The settings allow some custom types. ) :contentReference[oaicite:2]{index=2}
|
||
|
||
---
|
||
|
||
## 🔄 Nested admonitions
|
||
|
||
You can put admonitions *inside* other admonitions. This is great for making structured content like troubleshooting trees. Nested blocks must still follow the fenced code block + `ad-type` syntax. :contentReference[oaicite:3]{index=3}
|
||
|
||
Example:
|
||
|
||
```ad-note
|
||
title: Parent Note
|
||
collapse: open
|
||
|
||
This is the parent admonition content.
|
||
|
||
```ad-warning
|
||
title: Nested Warning
|
||
collapse: close
|
||
This is a warning inside the note.
|
||
```
|
||
|
||
More going on here...
|
||
```
|
||
|
||
---
|
||
|
||
## ⚙️ Customization & Settings
|
||
|
||
- You can **create custom admonition types** via plugin settings: pick your own type name, icon, color. :contentReference[oaicite:4]{index=4}
|
||
- You can override default type styles (colors/icons) with CSS or via customizing those custom types. :contentReference[oaicite:5]{index=5}
|
||
- There’s a setting for “collapsible by default”; if turned on, new admonitions will default to open or closed; you still can override per-block using `collapse:`. :contentReference[oaicite:6]{index=6}
|
||
- You can enable syntax highlighting inside admonition code blocks. :contentReference[oaicite:7]{index=7}
|
||
|
||
---
|
||
|
||
## ⚠️ Gotchas & Tips
|
||
|
||
- Because admonition blocks are handled as code block processors, **internal links/tags** may *not* always be picked up by Obsidian’s metadata cache (graph views / tag search) unless using “non-codeblock syntax” or custom types. :contentReference[oaicite:8]{index=8}
|
||
- Make sure you leave a blank line before `collapse:` or other parameters in some nested examples — formatting can get weird if lines run together. :contentReference[oaicite:9]{index=9}
|
||
- If you had been using the old plugin version or different syntax (without `ad-` prefix), note that in version 2.0.0 they changed it so all admonition types must be prefixed with `ad-`. :contentReference[oaicite:10]{index=10}
|
||
|
||
---
|
||
|
||
## 🧪 Sample blocks
|
||
|
||
```ad-note
|
||
title: Simple Note
|
||
This is just a plain note admonition.
|
||
```
|
||
|
||
```ad-tip
|
||
title: Pro Tip
|
||
collapse: open
|
||
If you can, use nested admonitions to separate concerns.
|
||
```
|
||
|
||
```ad-warning
|
||
title: Heads up
|
||
collapse: close
|
||
Something here might catch you off guard.
|
||
```
|
||
|
||
```ad-error
|
||
This is an error, no title.
|
||
```
|
||
|
||
```ad-info
|
||
title: FYI
|
||
Some info, maybe with links or lists:
|
||
- item 1
|
||
- item 2
|
||
```
|
||
|
||
---
|
||
|
||
Happy formatting, babe 😘 Let me know if you want a version of this styled for your theme (colors/icons/etc) so it *actually matches your Obsidian aesthetic.*
|
||
::contentReference[oaicite:11]{index=11}
|