Adds the ability to have keyboard icons in your Obsidian notes.
README.md

Keystyle #

An Obsidian plugin that styles keyboard keys (keycaps) in your notes, so documentation that references shortcuts stands out.

Usage #

Wrap keys in ++...++ — plain markdown, no HTML:

You type You get
Press ++Esc++ to cancel. a single Esc keycap
Save with ++Ctrl+S++. Ctrl + S keycaps
Open the palette: ++Ctrl+Shift+P++ Ctrl + Shift + P keycaps

Combos split on +, so each key gets its own cap joined by a small +. Keycaps render in both Reading view and Live Preview. In Live Preview, move the cursor onto a keycap to reveal and edit the raw ++...++.

Code and math are never touched: `++Ctrl++` in inline code, fenced code blocks, and $...$ math all stay literal. Wrapping in inline code is also the reliable way to show a literal ++Ctrl++ in a note.

Styling #

Sensible light and dark defaults ship with the plugin and follow your base color scheme. Everything is driven by CSS variables (--keystyle-kbd-*). To customize, open Settings → Keystyle and select Create CSS snippet — this writes an editable keystyle-keycaps.css into your vault's snippets folder, pre-filled with every class and variable. Enable it under Settings → Appearance → CSS snippets and tweak from there. Regenerating overwrites the file (you'll be asked first).

Local development #

Requires Bun 1.x.

bun install       # install dependencies
bun run dev       # esbuild watch — recompiles src/ into main.js on save
bun run build     # type-check + production bundle
bun run lint      # eslint

Hot reload into your vault #

The dev loop uses a symlink plus pjeby's Hot Reload plugin so edits appear in Obsidian without restarting the app.

  1. Symlink this repo into your vault as the plugin folder (folder name must equal the manifest id, keystyle-obsidian):

    bun run link
    # equivalent to:
    # ln -sfn "$PWD" "$HOME/Documents/Obsidian/MyVault/.obsidian/plugins/keystyle-obsidian"
    
  2. Install Hot Reload into the same vault:

    git clone https://github.com/pjeby/hot-reload \
      "$HOME/Documents/Obsidian/MyVault/.obsidian/plugins/hot-reload"
    

    (Hot Reload ships a prebuilt main.js — no build needed.)

  3. A .hotreload marker file at the repo root tells Hot Reload to watch this plugin.

  4. In Obsidian: Settings → Community plugins, turn off Restricted Mode, then enable Hot Reload and Keystyle.

  5. Run bun run dev. Editing any src/ file rebuilds main.js; Hot Reload reloads Keystyle automatically.

Manual install #

Copy main.js, manifest.json, and styles.css into <Vault>/.obsidian/plugins/keystyle-obsidian/, then enable the plugin.

Releasing #

  • Bump version in manifest.json (SemVer, no leading v) and add the "version": "minAppVersion" entry to versions.json. Running bun pm version patch|minor|major automates this via version-bump.mjs.
  • Create a GitHub release whose tag exactly matches the manifest.json version.
  • Attach manifest.json, main.js, and styles.css as individual release assets.

Funding #

To add funding links later, set fundingUrl in manifest.json — either a single URL:

{ "fundingUrl": "https://buymeacoffee.com" }

or a map of label → url:

{
  "fundingUrl": {
    "Buy Me a Coffee": "https://buymeacoffee.com",
    "GitHub Sponsor": "https://github.com/sponsors"
  }
}

References #