How to add Color to your code snippets using markdown
Jima Victor
Posted on January 1, 2022
Which one of these look better?
this?π
function printHello() {
console.log("Hello"); // prints hello to the console..
}
or this..π
function printHello() {
console.log("Hello"); // prints hello to the console..
}
That's right! The code snippet with colors definitely looks better and there are many advantages of using this feature built into text editors.
This feature that enables us to add colors to our code is known as syntax highlighting and it makes it easier and more enjoyable to read and understand code.
How to add syntax hightlighting in markdown
This is actually very easy to implement. All you have to do is add the name of the the programming language after the backticks in your markdown editor.
like thisπ
```javascript function printHello() { console.log("Hello"); // prints hello to the console.. } ```
and viola! You're done!!
Make the world beautiful today by adding some color to itπ
Happy New Year Codersπππ..
π πͺ π
π©
Jima Victor
Posted on January 1, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.