No description
Find a file
2026-06-14 11:28:20 +02:00
.github/workflows feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
src adding changes 2026-06-14 00:37:47 +02:00
.editorconfig feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
.gitignore Update .gitignore (#25) 2022-01-28 10:34:53 -05:00
.npmrc add version bump script (#10) 2022-01-22 16:13:50 -05:00
AGENTS.md feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
esbuild.config.mjs feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
eslint.config.mts feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
LICENSE adding readme and license file 2026-06-14 11:16:15 +02:00
manifest.json increasing version 2026-06-14 11:28:20 +02:00
package-lock.json feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
package.json feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
README.md adding readme and license file 2026-06-14 11:16:15 +02:00
styles.css Update sample css file. 2022-08-09 13:39:02 -04:00
tsconfig.json updating tsconfig.json 2026-06-14 00:38:41 +02:00
version-bump.mjs feat: modernize sample plugin 2026-05-29 19:15:56 +02:00
versions.json feat: modernize sample plugin 2026-05-29 19:15:56 +02:00

Code Style Keys

Code Style Keys is an Obsidian plugin that makes wrapping selected text in backticks faster while editing notes.

When you press the backtick key with text selected:

  • Single-line selection becomes inline code: selected text.
  • Multi-line selection becomes a fenced code block:

selected text

The plugin also prevents duplicate trailing backticks that can appear from the original keypress.

Why this plugin

This plugin is useful if you frequently format code snippets and want one quick key action instead of manually typing wrappers.

How it works

The plugin listens for the beforeinput event. If the typed character is a backtick and the active editor has a selection, it:

  1. Cancels the default input.
  2. Replaces the selection with inline or fenced code syntax.
  3. Performs a short cleanup pass to remove one extra trailing backtick when necessary.

Install for development

  1. Make sure Node.js 18+ is installed.
  2. Install dependencies:
npm install
  1. Start watch build:
npm run dev
  1. In Obsidian, reload the app and enable Code Style Keys in Community Plugins.

Build for production

npm run build

Manual installation

Copy these files into your vault at:

<Vault>/.obsidian/plugins/code-style-keys/

  • main.js
  • manifest.json
  • styles.css (if used)

Then reload Obsidian and enable the plugin.

Configuration

This version has no settings.

Compatibility

  • Desktop and mobile supported (isDesktopOnly: false).
  • Minimum app version is defined in manifest.json.

Development notes

  • Entry point: src/main.ts
  • Build tool: esbuild
  • Lint:
npm run lint

License

MIT