Kim Il
Mar 22, 2021

--

How to format code in medium

I needed to google it, because i did not find a formatting tool to format source code.

Type 3 backticks (`) to start a code block:

I just typed ``` in a new paragraph. A block popped with monospace font, which is the most important thing.

Syntax highlighting would be great, too. Can it be done? I don’t know yet, lets try, again with a new paragraph

```go
function Hello() {
printf(“Hello World”);
}
```

Nope, this didn’t work. I pressed CTRL-ALT-6 on the selected block.

Lets try with a codepen.io link:

Hmm, not really, can’t see my code.

Now JSFiddle:

Yupp, nice

I think i will go with https://jsfiddle.net, atleast for javascript code.

To be continued, please check back in a week or so, i want more syntaxes 🥳

--

--