Skip to content

dy-sh/obsidian-code-block-from-selection

Repository files navigation

Code block from selection

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.