How To Add a Code Block to Medium

Medium is a powerful blogging website that has attracted many writers focused on coding. The Medium draft window can format code to accommodate those writers who share coding languages with others. One of the most popular ways to format code in Medium is to use a code block. This will draw the reader’s eye to a code string by separating it from the rest of the text.

How To Add a Code Block to Medium

Even though the Medium draft window is based on your web browser, the commands to enter the code block will differ depending on your operating system. Keep reading to learn how to insert a code block into your Medium articles on any operating system.

How to Add a Code Block in Windows

If you use a Windows computer to write code, use the following instructions to enter a code block on Medium.

  1. Place your cursor where you would like to insert the code block.
  2. Press the following keys simultaneously: Control + Alt + 6.

The code block will appear automatically, and your cursor will be inside. You can type in your code there and begin formatting it as you would like.

How to Add Code Block in macOS

Use these instructions to insert a code block if you use a macOS computer to write in Medium:

  1. Set your cursor to where you want to insert the code block.
  2. Tap these keys at the same time: Command + Option + 6.

The code block will appear in the draft, and you can type your code directly into it. You will be able to format your code here as well.

How to Add Code Block in Linux

If you are using Medium on Linux, the type of computer you use will matter. For example, you will use a different process to insert a code block on a Windows computer operating Linux than on a MacBook operating Linux. Your success here will also depend on how you have mapped your keyboard within the Linux system.

Windows-Based Linux

If you have Linux on a Windows computer, use these instructions to insert a code block into a Medium draft:

  1. Put your cursor where you need to insert the code block.
  2. Press these keys at the same time: Control + Alt + 6.

The code block will pop up automatically, and you can type your code into it directly. You can also begin formatting as you would like.

macOS-Based Linux

If you use a MacBook to run Linux, you will likely have to verify that you have mapped your keyboard to be compatible with this process. In particular, the Control key in Linux must be mapped to the Command key on your MacBook keyboard.

To insert a code block into Medium if you have Linux running on a MacBook:

  1. Place the cursor where you need to insert the code block.
  2. Press the following keys at the same time: Command + Option +6.

Your code block will appear in the draft, and you can type your code directly into it. You will be able to format your code here as well.

Universal Trick to Add a Code Block

There is another way to insert a code block into a Medium draft that uses a special hotkey within the Medium software. This method is excellent because it works no matter what system you use to run Medium. To insert a code block into your Medium draft on any computer system:

  1. Place the cursor where you would like to insert the code block.
  2. Type in three backticks (“`). On any QWERTY keyboards, the backtick is located to the left of the number 1 key.
  3. The code block will automatically appear.

You can add your code directly into this code block and begin editing. This is an excellent second method for Linux users who could have trouble with the other process listed in this article.

Code Blocks for Writers

Medium offers multiple ways in which to format code inside its articles. However, the code block is likely the writer’s most powerful tool in setting code apart from other text. This is great for writers looking to draw attention. Since code blocks are a fantastic way to set coding apart from other text, writers may use code blocks often.

Have you ever inserted a code block into your Medium articles? Let us know about the experience in the comments below.

Leave a Reply

Your email address will not be published.


Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

Todays Highlights
How to See Google Search History
how to download photos from google photos