Meiorz14 downloadsRender Google Material Icons inline using !icon[name] syntax.
Render Google Material Icons in Obsidian using the !icon[name] markdown syntax.
![]()
Note: The animated mouse cursor seen in the demo is by Haku.
!icon[home], !icon[settings], !icon[check_circle]main.js, manifest.json and styles.css from the latest release<vault>/.obsidian/plugins/material-icons-inline/git clone https://github.com/meiorz/material-icons-obsidian
cd material-icons-obsidian
npm install
npm run build
Copy main.js, manifest.json and styles.css to your vault's plugin folder.
!icon[icon_name]
Icon names are lowercase with underscores, matching the names shown on the Google Material Icons site.
!icon[home] Home
!icon[settings] Settings
!icon[search] Search
!icon[check_circle] Task completed
!icon[error] Something went wrong
!icon[arrow_forward] Next !icon[arrow_back] Previous
!icon[check_circle]In the editor, icons behave like Obsidian's image embeds:
| State | What you see |
|---|---|
| Cursor elsewhere | Rendered icon |
Cursor inside !icon[...] |
Raw syntax |
This lets you edit the icon name without switching modes.
Access via Settings → Material Icons Inline.
| Setting | Default | Accepts |
|---|---|---|
| Icon Size | 24px |
Any CSS length: 16px, 1.5em, 2rem |
| Icon Color | currentColor |
Any CSS color: red, #ff0000, rgb(255,0,0) |
Invalid values fall back to the default silently.
styles.css (generated at build time from styles.src.css), which Obsidian loads and unloads with the plugin. No network requests are made.ViewPlugin scans visible text for !icon[name] patterns and replaces them with Decoration.replace widgets. Decorations are removed when the cursor enters the token range, revealing the raw syntax.TreeWalker to find text nodes and replaces each match with an <i class="material-icons-inline"> element via DocumentFragment.styles.css as the CSS variables --material-icons-inline-size and --material-icons-inline-color.Edit the regex in parseAndCreateIconHTML() and buildDecorations() in main.ts:
// Current: !icon[home]
const iconRegex = /!icon\[([a-z0-9_]+)\]/g;
// Alternative: {{icon:home}}
const iconRegex = /{{icon:([a-z0-9_]+)}}/g;
Edit DEFAULT_SETTINGS in main.ts:
const DEFAULT_SETTINGS: MaterialIconsSettings = {
iconSize: '20px',
iconColor: 'currentColor'
}
npm test # run all tests
npm run test:watch # watch mode
npm run test:coverage # coverage report
Ctrl+Rstyles.css is in the plugin folder next to main.js (it contains the icon font)Ctrl+Rcheck_circle not check circle or Check_Circle| Syntax | Description |
|---|---|
!icon[home] |
Home |
!icon[settings] |
Settings |
!icon[search] |
Search |
!icon[edit] |
Edit |
!icon[delete] |
Delete |
!icon[check_circle] |
Done / Completed |
!icon[error] |
Error |
!icon[warning] |
Warning |
!icon[info] |
Information |
!icon[favorite] |
Favorite |
!icon[bookmark] |
Bookmark |
!icon[arrow_forward] |
Next |
!icon[arrow_back] |
Previous |
!icon[download] |
Download |
!icon[upload] |
Upload |
!icon[star] |
Star |
Mouse Cursor: The 戌神ころね (Inugami Korone) animated mouse cursor seen in demo.gif is created by Haku and is not affiliated with this plugin. You can download the cursor here.
Icon font: Material Icons by Google, licensed under the Apache License 2.0. The font is bundled from the material-icons npm package.
MIT
Pull requests and issues welcome.