How to create Inline and Separate Code Blocks in Medium with non US keyboard

The reason why you are not able to create code blocks.

Johannes Eder
3 min readMay 21, 2022
QWERTZ keyboard layout — image from the author

I few days ago I started to write on my first Medium article. (Check it out here: https://tinyurl.com/5n7yvfrp)

One thing I quickly came across as a technical writer was the difficulty of displaying inline or separate code cells using the single backtick ` (for inline code blocks) or the tripple backticks ``` (for separate code blocks). I was wondering why my backticks were not working.

After some research I found that the problem is my default keyboard layout. As an austrian citizen I find myself using the, of course, Austrian keyboard layout on my Apple Macbook M1. This is a problem since on my laptop the backtick has a different default functionality compared to the US English keyboard. In detail my backticks are converted to indicate a special pronunciation of a letter in a word. In case of the backtick this is also called Grave accent.

Using backticks with my default keyboard creates Grave accents.

Completely changing my default keyboard to the US English was not an option for me since I have adjusted my writing to the QWERTZ layout as used in Central Europe. It differs from the american QWERTY layout in the position of specific letters. Thus this would make my writing speed much slower since I am not used to that. Nevertheless, when I am writing in Austrain speech we need “mutated vowels” or “Umlaute” (ä,ö,ü) as we call them in German.

The easiest fix I found for myself is to set a second keyboard (Apple menu > System Preferences > Keyboard) and there use the US layout:

In the Apple keyboard settings we have to add a the US layout as second keyboard.

So by default when writing on Medium I can use the Austrian layout but if I want to add inline code I then press control + spacebar, which switches my layout to the US one, and press the < button (next to the letter Y on my keyboard) which gives me the desired backtick ` functionality.

Best practice: Write the whole blog with your normal keyboard setting and then when you proofread the article switch to the US layout and mark everything as code cell that is needed in one go. This avoids switching back and forth between the two layouts.

If you found this quick fix useful please leave a like! 👏

Follow me here on Medium if you want to keep up with my recent work and writing.
Also feel free to leave your feedback! ✋

Happy coding and problem solving! 🧑‍💻🔐

--

--

Johannes Eder

Mathematician and Python Programmer writing about Data Science, Simplicity and Focus! | I write to learn-to-explain and explain-to-learn.