Skip to content

Lauloque/Keyboard-Formatter

Repository files navigation

Keyboard Formatter

License Ko-fi

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.

Features

  • Effortless Formatting: Select text containing keyboard key names and press a keyboard shortcut of your choosing to format them. For examplectrl shift a will 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
    • Directions like up and left become ↑ Up ← Left to mimic arrow keys
    • Numpad keys such as numpad . or numpad 5 will 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!

How to Use

  1. 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:
      image
  2. 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.

Support My Work

Support me on Ko-fi

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.

About

Formats keyboard text (kbd) in your Obsidian notes quickly and consistently.

Resources

License

Stars

Watchers

Forks

Packages

No packages published