How to display codes on Medium

Code Blocks, Inline Code and Gists

Ravic Poon
1 min readMay 12, 2020

Code Blocks

def call(*args)
puts args
end

Type triple backtick (```) on a new line or highlight the text and enter:

  • command⌘ + option + 6 for Mac,
  • Ctrl + alt + 6 for Windows

Inline code

multiply = -> (x,y) { x * y }

Type single backtick (`) at the beginning of your codes or highlight the lines of code then enter a backtick (`)

Gists

Some ruby code that i wrote for a leetcode question

Create a new gist, copy its sharable link, paste it to your article and press enter.

--

--