Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Join the community
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Code block from selection

dy-shdy-sh12k downloads

Turn the selected text into a code block.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates8

This plugin for Obsidian adds a "Code block from selection" command that turns the selected text into a code block. It just adds ``` before and after the selected text. In the plugin settings you can specify which language to use in the code block. You can add as many languages as you like and assign hotkeys to them.

How to configure

Specify the programming language in the plugin settings (for example "c++"), then add the desired hotkey for the "Code block from selection" command on the Obsidian hotkeys panel.

How to use

Just select the text with code or put the cursor on the desired line and press hotkey.

78%
HealthExcellent
ReviewSatisfactory
About
Wrap selected text or the current line in a fenced Markdown code block with a single command. Specify one or many languages in settings and assign hotkeys for quick insertion.
CodeHotkeys
Details
Current version
1.0.8
Last updated
3 weeks ago
Created
5 years ago
Updates
8 releases
Downloads
12k
Compatible with
Obsidian 0.9.12+
License
MIT
Report bugRequest featureReport plugin
Sponsor
Buy Me a Coffee
Author
dy-shdy-sh
github.com/dy-sh/
GitHubdy-sh
  1. Community
  2. Plugins
  3. Code
  4. Code block from selection

Related plugins

Templater

Create and use dynamic templates.

PlantUML

Generate PlantUML diagrams.

Emoji Toolbar

Quickly search for and insert emojis into your editor.

Tray

Run Obsidian from the system tray for customisable window management and global quick notes.

Colored Text

Color the selected texts.

VSCode Editor

Edit Code Files like VSCode.

JS Engine

Run JavaScript from within your notes.

CustomJS

Reuse custom JavaScript across desktop and mobile.

Mousewheel Image zoom

Increase or decrease the size of an image by scrolling.

Floating Search

Search text by using Obsidian default search view.