javalent / admonitions

Adds admonition block-styled content to Obsidian.md
MIT License
1.07k stars 71 forks source link

Feature: Support more icon pack via obsidian-icon-shortcodes #199

Closed aidenlx closed 2 years ago

aidenlx commented 2 years ago

I'm the dev of Icon shortcodes plugin, a plugin that includes an icon manager to manage user-imported custom icons, and icon packs such as Font Awesome, Remixicon, RPG Awesome, etc.

In the upcoming v0.7.0+, it will no longer bundle any svg icons and use lucide icons available in obsidian v0.13.27+, and provide a icon pack browser to easily download icon packs. Imported icons are stored as files in .obsidian/icons, so including more icons won't cause memory problem caused by loading icons in json file or increase bundle size

You can check here for details about its api: https://github.com/aidenlx/obsidian-icon-shortcodes#for-developer. link favicon already support icon shortcodes so it might be a good place to reference code. In v0.7.0+, the api doesn't contain any breaking changes, so it's safe to develop against published version of obsidian-icon-shortcodes.

feel free to ask if you have any question :)

aidenlx commented 2 years ago

icon shortcode v0.9.0 support callout icon, closing this now.

valentine195 commented 2 years ago

And I was just working on this last night! 😁

aidenlx commented 2 years ago

btw, if you are implementing a interface to manage custom callout icon, you can check out getIconFromUser method which can open a modal to prompt user for icon selection (available since v0.6.1)

valentine195 commented 2 years ago

I just inject a detached stylesheet with the custom admonitions defined as callouts, with icons defined using an SVG tag.

aidenlx commented 2 years ago

I've done it in post processor, adding a mutation observer for icon injection and insert custom icon when no icon is rendered by default renderer. https://github.com/aidenlx/obsidian-icon-shortcodes/blob/master/src/post-ps/callout-icon.ts