Code Style Keys

by Aiday Marlen Kyzy
5
4
3
2
1
New Plugin

Description

This plugin has not been manually reviewed by Obsidian staff. Adds backtick shortcut for code blocks.

Reviews

No reviews yet.

Stats

stars
downloads
0
forks
0
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

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

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