GlyphIt

by Jakob Marasch
5
4
3
2
1
Score: 50/100

Description

Reviews

No reviews yet.

Stats

0
stars
404
downloads
0
forks
57
days
58
days
58
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
22
commits

Latest Version

2 months ago

Changelog

Fixed

  • Icon packs no longer assume .obsidian. The pack folder is now created inside whatever configuration folder your vault actually uses. Existing installs keep their current path, so nothing moves and nothing is lost.
  • Icons in popped-out windows. Inline icon detection and timers used the main window's globals, so icons in a popped-out note could fail to render.

Changed

  • Icon markup is parsed and sanitized before it reaches the page. Icons come from packs you install, so they are now treated as untrusted input: inline event handlers, javascript: URLs and script-bearing elements are stripped out. Previously the SVG was inserted as raw HTML.
  • JSZip replaced with fflate. No dependencies, and it removes the runtime script injection and eval that JSZip's polyfill chain pulled into the bundle. Reading icons out of a pack is about four times faster.
  • Appearance moved into the stylesheet. Icon styling was applied inline, which put it out of reach of themes and CSS snippets. It is now CSS classes, so both can override it.

Removed

  • The default Ctrl/Cmd+Shift+J hotkey. Default hotkeys can silently clash with your own bindings. The command is unchanged and you can assign it a key under Settings → Hotkeys.

Verified against all fourteen published icon packs — 24,348 icons, no difference in what is read.

README file from

Github

GlyphIt

Add icons to anything in Obsidian — files, folders, tabs, titles and inline text.

Originally a fork of Iconize by Florian Woelki, which is no longer maintained. GlyphIt keeps the same core idea and reworks how icon packs are stored so that very large packs stay fast.

What's different

Icon packs stay zipped. A pack is never unpacked to disk. On start-up only a small index of what each pack contains is read, so a pack of 8,000+ icons costs a few milliseconds instead of thousands of file reads.

Icons are extracted on first use. The first time an icon is actually used it is written to a cache directory as a plain .svg, and every later render reads that file. A vault pays for the icons it uses, not the packs it has installed.

Subfolders and duplicate names work. Packs can nest icons in folders, and the same filename can appear in several of them. Names stay short and only become folder-qualified where they would otherwise be ambiguous:

lorc/acorn.svg           ->  GiAcorn                 (unique, stays short)
lorc/sandstorm.svg       ->  GiLorcSandstorm         (ambiguous, qualified)
delapouite/sandstorm.svg ->  GiDelapouiteSandstorm

Color is applied at render time. Icons that hard-code their color on the shapes rather than the root element are recolored correctly, so a single pack covers every color instead of needing one copy per color.

Packs can be rescanned. Edit a pack's .zip or folder, then hit the rescan button next to it in settings to pick the change up without restarting Obsidian.

Layout on disk

.obsidian/icons/
  game-icons.zip                      the pack, never unpacked
  my-custom-pack/                     a folder pack you fill yourself
  .cache/
    index/game-icons.json             what is inside that pack
    icons/game-icons-ff8800-none-lorc-sandstorm.svg

Cached icons are named library-foreground-background-folder-name.svg, so what each cached file is for is readable at a glance.

Development

Requires Node 20+.

git clone <this-repo>
cd glyphit
npm install
npm run dev

npm run dev builds to ./main.js in the project and watches for changes.

To have the build install itself into a vault automatically, create an env.js in the project root (it is gitignored):

export const obsidianExportPath =
  '<path-to-your-vault>/.obsidian/plugins/glyphit/';

Without env.js the build still works, it just does not copy anywhere.

Other commands

Command Does
npm run build Production build, no source maps
npm test Run the test suite
npm run test:coverage Tests with coverage thresholds
npm run lint ESLint with --fix
npm run prettify Format with Prettier
npm run docs:dev Serve the VitePress docs

Credits

GlyphIt is a fork of Iconize by Florian Woelki, which is no longer maintained. Icons on files, folders, tabs, titles and inline text, custom rules, frontmatter support and the plugin API all originate from that project.

Icon packs are made by other people and remain under their own licenses — see CREDITS.md for the full list.

License

MIT — see LICENSE, which retains the original copyright alongside this fork's, as the license requires.