Formats keyboard text (kbd) in your Obsidian notes quickly and consistently.
This Obsidian plugin allows you to select text within your notes and, with a simple keyboard shortcut of your choosing , automatically format common keyboard keys and mouse buttons using HTML <kbd> tags. This provides a visually distinct and semantic way to represent user input instructions in your writing.
- Effortless Formatting: Select text containing keyboard key names and press a keyboard shortcut of your choosing to format them. For example
ctrl shift awill become ⌃ Ctrl ⇧ Shift A. - Special Keys Recognition:
- Common modifier keys: ⌃ Ctrl ⇧ Shift ⎇ Alt ⌘ Cmd Win etc.
- Function keys: F1-F12
- Command keys ⇥ Tab, ⌦ Delete ⏎ Enter ⌫ Backspace
- Directions like
upandleftbecome ↑ Up ← Left to mimic arrow keys - Numpad keys such as
numpad .ornumpad 5will be formatted as Numpad • or Numpad 5
- Mouse Button Formatting: "lmb" as Left 🖱️, "rmb" as Right 🖱️, "mmb" as Middle 🖱️, and "wheel" or "scrollwheel" as Wheel 🖱️.
- Case-Insensitive Matching: Key names are recognized regardless of their capitalization (e.g., "Ctrl", "ctrl", and "CTRL" all become ⌘ Ctrl).
- Single Letter Capitalization: Capitalizes single-letter words (useful for individual key presses), like "a" becoming A.
- Light and Dark themes for everyone to enjoy!
-
Install the plugin:
- Open Obsidian.
- Go to Settings -> Community plugins.
- Make sure Safe mode is off.
- Click Browse and search for "Keyboard Formatter".
- Click Install and then Enable the plugin.
- Alternatively, you can manually install it by copying the contents of the latest GitHub release from this repository into your Obsidian vault's plugins folder (
<your_vault>/.obsidian/plugins/keyboard-formatter), then enable the plugin from your Obsidian's Community plugins list. - From the Community Plugins section, click the ➕ icon to set up your keyboard shortcut for this plugin, or click the ⚙️ icon to customize the text and background colors used for the KBD elements:

-
Format text:
- Open a Markdown note in Obsidian.
- Select the text you want to format (e.g.,
ctrl shift a). - Press the keyboard shortcut to run the tool
- The selected text will be transformed into:
<kbd>⌃ Ctrl</kbd> <kbd>⇧ Shift</kbd> <kbd>A</kbd>which looks like this: ⌃ Ctrl ⇧ Shift A.
This plugin uses cross-platform Unicode symbols for keyboard keys to ensure consistency across different platforms and applications. Here's the mapping of symbols used:
| Symbol | Key |
|---|---|
| ⌃ | Control/Ctrl |
| ⇧ | Shift |
| ⎇ | Alt |
| ⌥ | Option |
| ⌘ | Command/Cmd |
| Symbol | Key |
|---|---|
| ⇥ | Tab |
| ⏎ | Enter/Return |
| ⌫ | Backspace |
| ⌦ | Delete |
| ⇪ | Caps Lock |
| ⎋ | Esc |
| ↑←→↓ | Directional Arrows |
| Symbol | Key |
|---|---|
| ⊞ | Win |
| ❖ | Super |
| ◆ | Meta |
This is a simple summary of the official sample-plugin docs. If you need more info, go there first.
-
Clone the repo locally, ideally inside a test vault for easy testing, e.g.
<test-vault>/.obsidian/plugins/Keyboard-Formatter -
Open a terminal in the repo to install dependencies and run the development build:
npm install npm run dev
This will watch the TypeScript sources and automatically rebuild
main.jswhenever you save. Keep this running while you work. -
After each update of the plugin, you need to refresh it in Obsidian too. Either:
- Disable/re-enable it in Obsidian
- Use a hot-reload plugin such as this one
Following: Using GitHub actions to create releases for plugins - Obsidian Hub - Obsidian Publish
After validating the changes, gotta make a new release available to Obsidian's repo.
- Update the manifest.json with the right version, commit and push it.
use git tag , e.g.
git tag 1.0.0using semantic versioning. - Push the new tag to GitHub
git push origin --tagsGitHub takes care of the rest
If you find this plugin helpful and would like to support its development, you can buy me a coffee on Ko-fi! Your support is greatly appreciated.
Thank you for using Obsidian Keyboard Formatter! If you have any issues or suggestions, please feel free to open an issue on this repository.