Sitemap

Medium | How to write code blocks

I had just started writing about my coding and data science adventures when I wanted to use code blocks on my posts. It took me about 40 minutes to find the solution.

Use ( ` ) this backtick to start a piece of code. Example:

Get Gustavo Adolfo Diez González González’s stories in your inbox

Join Medium for free to get updates from this writer.

this is a piece of code

But then, if you hit enter, or if you want to paste a whole bunch of code, it may not work, so you will need three backticks (```) and once you hit the third one, the code block appears.

This is a codeblock with the three backticks.

Hope this helps.

--

--