The discussion is about adding markdown to selected text in the Discourse forum. alltiagocom wants to be able to select a word or sentence and automatically surround it with backticks by hitting the backtick key, similar to how it works in Obsidian. Jakke Lehtonen mentions that this is not possible, but suggests selecting the text and using the toolbar or cog to add backticks.
Coin-coin le Canapin explains that there is a single button and shortcut for both inline code and code blocks, and that the behavior depends on whether the selection contains a line break. The correct names for the options are inline code and code block.
The discussion also touches on customizing the toolbar and cog, which Coin-coin le Canapin says is not possible from the interface. Jay Pfaffman suggests using the control-e shortcut to surround selected code with backticks, but alltiagocom explains that it’s about muscle memory from using Obsidian, where hitting the backtick key is a more direct way to add markdown.
Overall, the community provides clarification on how to use markdown in the Discourse forum, and alltiagocom is grateful for the explanations. Coin-coin le Canapin also shares a link to the documentation on posting code or preformatted text.
I don’t know if this is possible at all, but for example in Obsidian I am able to select a word or sentence and then hit the backtick to automatically surround the word or sentence with a backtick (or 3 backticks for code).
Would this possible to implement here? I find myself trying this quite often, because of my extensive use of it in Obsidian.
Sorry, you can’t. But you can select piece of text and then open the cog from toolbar and choose the first one (mine speaks Finnish… is it preformatted or something) and then it uses one tick inline and three ticks for a chapter.
Matter of taste, but adding ticks using old way is much more faster.
There’s a single button (and shortcut) for both preformatted text types.
If you haven’t selected any text, it will create an inline code.
If your selection is no more than 1 line, it will create an inline code.
If your selection contains a line break, it will create a code block.
As far as I know, and unfortunately, not from the interface.
See:
I used the shortcut a few times now.
My thing is that I use the ticks a lot in Obsidian, so it’s more about muscle memory of just selecting the word or sentence and hit the backtick key. Obsidian goes a step further with single and double quotes, parenthesis, brackets (curly and square), etc.