# "Toggle code block" command that wraps the selection with three backticks

**URL:** <https://forum.obsidian.md/t/toggle-code-block-command-that-wraps-the-selection-with-three-backticks/82359>\
**Category:** Feature archive\
**Created:** [May 24, 2024, 1:29pm UTC](https://forum.obsidian.md/t/toggle-code-block-command-that-wraps-the-selection-with-three-backticks/82359 "2024-05-24T13:29:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ariehen](https://forum.obsidian.md/user_avatar/forum.obsidian.md/ariehen/32/46932_2.png) [@ariehen](https://forum.obsidian.md/u/ariehen)\
**Post date:** [May 24, 2024, 1:33pm UTC](https://forum.obsidian.md/t/toggle-code-block-command-that-wraps-the-selection-with-three-backticks/82359/2 "2024-05-24T13:33:24Z")

</div>

If you are willing to install the _Templater_ plugin, you could try using this. It’s set for a `css` code block, but can be changed or duplicated to whatever is needed.

> [@Easy text selection into a code block using a hotkey (Templater)](https://forum.obsidian.md/t/easy-text-selection-into-a-code-block-using-a-hotkey-templater/80055):
>
> Mostly for CSS, but I found myself wanting to quickly create a fenced code block from selected text without typing ``` and then the code language over and over again. I’ve been using a few different versions for months now without issue. Hopefully, a few of you will find it useful! Setup: Install the Templater community plugin. Paste the below code into a new note, give it a template sounding name that works for you, and move it to your Templater templates folder. Set a “Template Hotkey…

---

_[View the full topic](https://forum.obsidian.md/t/toggle-code-block-command-that-wraps-the-selection-with-three-backticks/82359)._
