Hello,
I am currently on MacOs and I would like to format selected text in code format while pressing only backtick like Slack does.
I cannot set an hotkey with only the backtick key.
Is it possible?
Thank you.
Hello,
I am currently on MacOs and I would like to format selected text in code format while pressing only backtick like Slack does.
I cannot set an hotkey with only the backtick key.
Is it possible?
Thank you.
That already works by default. Make sure Settings > Editor > âAuto pair Markdown syntaxâ is enabled. If youâre doing a code block instead of inline code youâll need to type 3 backticks.
This works for bold and italic formatting. Not for code formatting.
That text should probably be changed. Or maybe Iâve misunderstood which setting controls this, but I can definitely highlight text and type backticks to make it a code block.
When I do that, it deletes the highlighted text and inserts a backtick caracters.
Do you have any clue why this does not work ?
@CawlinTeffid (after toggling the Auto pair Markdown syntax back on) I found that the following quote characters work on MacOs: "
and '
, but not `
. The backtick replaces the selected text.
After a little more testing I found the following to work: [{($%='"
, but not <ÂŤââ`´#
. So there might be a need/want to update which characters are to be allowed when doing the auto pairs. I would consider the backticks, various smart quotes, and the angular quotes to be especially useful. Quite a few languages uses something besides the normal straight single and double quotes.
Here is a video of backticks working as expected in the Sandbox vault on a Mac:
It also works for inline code.
I donât know why itâs not working is some vaults, but the troubleshooting steps in the Obsidian debugging guide can help find the source of the problem: About the Bug reports category - #11 by system
Trying the same thing in the Sandbox Vault (does not work):
Strange! Can you run âShow debug infoâ in the command palette (in the Sandbox vault) and paste the output here?
Also it would help to mention your MacOS version â mine is 14.1.2.
Hereâs my debug info:
SYSTEM INFO:
Obsidian version: v1.5.3
Installer version: v1.5.3
Operating system: Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:12 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8103 23.1.0
Login status: logged in
Catalyst license: none
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 0
Plugins enabled: 0
RECOMMENDATIONS:
none
MacOs version 14.2.1
Hereâs my debug info:
SYSTEM INFO:
Obsidian version: v1.5.3
Installer version: v1.4.14
Operating system: Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020 23.2.0
Login status: logged in
Catalyst license: none
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on
RECOMMENDATIONS:
none
Hm, so your MacOS is a little newer and your Obsidian installer version is a little older. I wouldnât expect either of those to make a difference) you could try reinstalling Obsidian to get the latest installer version but I donât think itâll fix the issue.
Maybe a MacOS keyboard setting is making the difference? Maybe not â toggling MacOSâs âsmart punctuationâ and âsmart quotesâ settings (and resetting the sandbox vault) didnât change the behavior.
What language input do you have set when youâre doing this?
That little underline under the ` (in your video) generally indicates you are in an alternative input mode.
Here Iâm in Japanese - Romaji and typing the ` character (Apple Magic Keyboard - US). Then I switch to English. Then back to Japanese - Romaji.
Not sure if thatâs whatâs happening in your case, but something to check.
Good cach @ariehen Iâm using French keyboard.
When I switch to US keyboard, it works.
Is there any possibility that dev fixes that?
I would realy LOVE this feature.
I think itâs worth filing a bug report.
@CawlinTeffid , are you using an English keyboard layout? If so, is the backtick a dead space character on your keyboard? I suspect itâs not, and that might be the issue.
On a Norwegian keyboard and Iâm assuming on the French keyboard we can use the backtick key to build accented characters like èà and so on. To actually get the backtick we need two keypresses, the backtick key and the space key. If I remember correctly on the English keyboard, you just need to press the one key with the backtick, right?
And this might be why it doesnât work in our context, but do work in yours and other keyboard having the same characteristics.
I filed a bug here, if you want to comment: Auto pair madown code syntax does not work on other keyboars than US (on MacOS)
I am using an English layout, and it does sound like thatâs the issue.
@fran_cis_co Out of curiosity, is French set as your primary language in the macOS Language & Region settings? (I assume it is, but just checking)
Thereâs an old bug report here about the âdeadkey backtickâ, but it was fixed a while ago.
Itâs not, english is, but I have french keyboard layout.
Same issue here:
Backtick and circonflex accent are dead keys on the French keyboard: they do not insert a full character (e.g. pressing the backtick key after e
outputs è
)
This causes issues when typing code, e.g. when toggling inline code in Obsidian (select text then press backtick).
I fixed the issue using this workaround:
French-backtick-circumflex.bundle
(modified keyboard layout using Ukulele)/Library/Keyboard Layouts
In Obsidian, you should now be able to toggle inline code when selecting text and pressing the backtick key.