Skip to content

obsidian/functions/setIcon

Mock of Obsidian’s setIcon.

Function Description
setIcon Puts an icon at the start of an element, as Obsidian does. When the element’s first child is already an <svg> carrying the icon id as a class, nothing changes. Otherwise that first child, whatever it is, is removed and the icon from getIcon is appended; when there is no such icon, the first child is still removed. The mock knows only icons added with addIcon; see getIcon.