Photo by Chris Ried on Unsplash
I've noticed this on web on some sites they didn't have syntax highlighting for their code snippets the code is just white text on black background.
When you add your code snippets on the web or here on dev.to you can specify the language of the snippet in markdown while using it in that way the syntax highlighting is enabled.You can add it html and markdown.So it provides better readability. Hope this helps out someone.
Example code snippet without specified language:
const funYou = () => console.log("I am function 😃");
funYou();
def add(n1,n2):
return n1 + n2
echo "Hello World"
{
"Name": "jack",
"Age": 25,
"Location":"Spain"
}
You can add syntax highlighting by just adding the language name after 3rd backtick. just like following example:
Example code snippet with specified language:
const funYou = () => console.log("I am function 😃");
funYou();
def add(n1,n2):
return n1 + n2
echo "Hello World"
{
"Name": "jack",
"Age": 25,
"Location":"Spain"
}
Top comments (0)