guopenghui / obsidian-quiet-outline

Improving experience of outline in Obsidian
MIT License
315 stars 17 forks source link

[FR] Add support for rendering icons #74

Open manu-romero-411 opened 1 year ago

manu-romero-411 commented 1 year ago

It could be interesting if the plugin allowed to render icons in note headings. Plugins such as Icon Shortcodes and Obsidian Icons can render icons everywhere in notes, including callouts and headings. Adding icons in headings using the mentioned plugins result in some odd strings where the icon should be. Maybe this could be added along with the existent markdown support, or does it depend more on the development of the other plugins?

skaviouz commented 1 year ago

Uhm, do you mean like this: image

Where it shows just :rat: and not the actual emoji? Because in my example I used the literal: 🐀 emoji and then manually typed in :rat:. From my experience, some plugins render short codes while others only insert them.

Here are some example Options:

d9k commented 1 year ago

You can call another plugin api like this (works in DevTools of Obsidian app, Ctrl+Shift+I):

var i = app.plugins.plugins['obsidian-icon-shortcodes'];
i.api.getIcon(':wave')
var exampleString = ':wave:, world!'
i.api.postProcessor(exampleString, (iconText) => i.api.getIcon(iconText).outerHTML)

Result:

Screenshot from 2023-11-03 12-11-31

d9k commented 1 year ago

Added pull request https://github.com/guopenghui/obsidian-quiet-outline/pull/137 with support for Icon Shortcodes plugin.

@manu-romero-411, you can replace main.css, style.css in plugin folder with files from my version https://github.com/d9k/obsidian-quiet-outline/tree/d9k and restart Obsidian

Result:

Screenshot from 2023-11-03 12-08-21|h:120