As someone who likes to integrate code snippets into my programming notes, I think a dedicated hotkey for code blocks would be great.
Maybe a small selector for the different programming languages supported by the currently used CodeMirror version in Obsidian would make it even more useful.
This is not a solution to the problem, but a misunderstanding. What you’re describing is QUOTES and BLOCKQUOTES inside markdown files. What @hqgu suggested is actual codeblocks that are supported by Obsidian’s CodeMirror integration.
Current workflow:
Currently when I have a single line of code that I want to have inside my notes, I basically open the command panel and have “toggle code” pinned to the top. This only works for single lines, e.g. this could be a line of code. Alternatively you could bind the “toggle code”-command to a hotkey and press it 3 times.
But if you want to toggle a codeblock, you have to manually set the triple dashes and declare a programming language before pasting your actual code.
# This program prints Hello, world!
print('Hello, world!')
Which takes a bit more time, a few more keystrokes and could really be more comfortable solved than the current implementation.
(Therefore bumping this thread since it could be a great QoL feature.)