Note: This plugin was generated and debugged entirely by Cursor AI by a user with no coding experience. It demonstrates the power of AI-assisted development to create fully functional software.
An Obsidian plugin that adds Lucide icons to internal wiki-links based on the folder path of the linked file.
- 🎨 Add Lucide icons to internal wiki-links
- 📁 Map folder paths to specific icons with per-folder colors
- ⚙️ Customize icon position (before or after the link)
- 🎨 Adjustable icon size and default color
- 🎨 Per-mapping color customization with visual color picker
- 🔄 Automatically processes links in markdown views
- 👁️ Works in both Reading View and Live Preview mode
- 🎯 Uses CodeMirror decorations for stable rendering in Live Preview
- Copy this plugin folder to your Obsidian vault's
.obsidian/plugins/directory - Run
npm installto install dependencies - Run
npm run buildto build the plugin - Enable the plugin in Obsidian Settings > Community Plugins
# Install dependencies
npm install
# Build in production mode
npm run build
# Build in development mode with watch
npm run dev- Open Settings > Link Icon Settings
- Configure icon position (before or after link)
- Set default icon size and color (used as fallback for mappings without custom colors)
- Add folder-to-icon mappings:
- Click "Add mapping"
- Select folder path from the autocomplete dropdown (or leave empty for root folder)
- Pick an icon from the visual icon picker
- Optionally set a custom color for this specific mapping using the color picker or CSS color
- Icons will automatically appear next to links in both Reading View and Live Preview
All icons from Lucide are supported. Common examples:
file-text- Text filesfolder- Folderscalendar- Daily notesarchive- Archive folderspaperclip- Attachmentslayout-template- Templates- And many more...
- Icon position: Choose whether icons appear before or after the link
- Icon size: Adjust icon size (10-32 pixels) - applies to all icons
- Default icon color: Set default color for icons (CSS color, hex code, or CSS variable like
var(--text-normal)). Includes a visual color picker. - Folder Icon Mapping: Map folder paths to specific icons
- Each mapping can have its own custom icon
- Each mapping can optionally have its own custom color (overrides default color)
- Visual icon picker shows all available Lucide icons
- Color picker allows easy selection of hex colors or CSS variables
The plugin:
- Detects internal wiki-links (
[[link]]) in markdown views (both Reading View and Live Preview) - Resolves the linked file and gets its folder path
- Matches the folder path to an icon mapping using your settings
- Uses the mapping-specific color if set, otherwise falls back to the default color
- Renders the icon before or after the link based on your position setting
- Reading View: Uses markdown post-processor to add icons to rendered HTML
- Live Preview: Uses CodeMirror decorations and widgets for stable, persistent icon rendering
- Icons are matched from most specific to least specific:
- Exact folder path match
- Parent folder matches (walking up the directory tree)
- Root folder default (if a mapping exists for empty path)
When a link points to a file, the plugin:
- Gets the file's parent folder path
- Checks for an exact match in your folder mappings
- If no exact match, walks up the directory tree checking parent folders
- Uses the most specific match found
- If no mapping exists, no icon is shown