Best way to create code blocks

What I’m trying to do


I try to create multi lines block quotes for a specific language. To do this I successively type three backticks then the name of the language and paste the code.

I come from Roam Research when you can do this by a keyboard shortcut (Cmd-/ followed by the name of the language) that creates automatically the code block with the cursor placed where you can paste the code.

Is there a way to do the same in Obsidian? Do I need to use a « shortcut » plugin?



I don’t believe there is currently a way to do it without a shortcut/snippet plugin.

The only command I’m aware of is “Toggle code” which only toggles single-line code, not multi-line blocks.

Could make a nice feature request. Or discuss in this thread: Meta Post - Hotkeys

(Interestingly enough, if you select a block of text, including a line above and below, and run that command 3 times (say, with a hotkey assigned), you end up with a triple-tick code block, minus the language definition.)

1 Like

Thank you for your confirmation. I wanted to be sure I didn’t miss something.

There is the Markdown formatting assistant plugin where you can use \ to trigger creating a code block or inline code. Typing \co then enter is enough to create a code block. a mermaid code block can also be created with \m.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.