- TypeScript 88%
- CSS 12%
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.
-
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" -
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.) -
A
.hotreloadmarker file at the repo root tells Hot Reload to watch this plugin. -
In Obsidian: Settings → Community plugins, turn off Restricted Mode, then enable Hot Reload and Keystyle.
-
Run
bun run dev. Editing anysrc/file rebuildsmain.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
versioninmanifest.json(SemVer, no leadingv) and add the"version": "minAppVersion"entry toversions.json. Runningbun pm version patch|minor|majorautomates this viaversion-bump.mjs. - Create a GitHub release whose tag exactly matches the
manifest.jsonversion. - Attach
manifest.json,main.js, andstyles.cssas 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 #
- API documentation: https://docs.obsidian.md
- Developer policies: https://docs.obsidian.md/Developer+policies
- Plugin guidelines: https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines