EDDYMENS

Last updated 2022-09-23 22:13:16

Highlighting Code Snippets In Markdown

For technical articles containing code examples, it's important and helpful to present them in the most legible way possible.

You can use the backtick (`) symbol to highlight inline code for example, console.log(). Inline code examples are the kind you find embedded within a sentence.

This is done using a single backtick on each side of the code example.

01: `console.log()`

To create a stand-alone block of code like the one above you will need to place the code example between three backticks at the beginning and end of the text.

This is known as a fenced code block.

Depending on the markdown parser capability it might allow you to specify the language right after the opening backticks and this is usually used by the rendering platform to provide highlighting if available.

01: ```javascript 02: 03: if(true) { 04: // do something 05: } 06: 07: ㅤ```

Here is another article for you 😊 "How to create a list in Markdown"