DEV Community

Discussion on: Clean up your code by applying these 7 rules ⚡️

Collapse
 
imjoshellis profile image
Josh Ellis • Edited

Great post!

Consider specifing the language in your markdown code blocks because Dev.to has syntax highlighting!

You can do this by adding the language after the first three backticks at the start of your code block:

// code block starts with '''js (but with backticks instead of ')
const fn = () => {
  const x = "hello"
  return 3 + x
}
Enter fullscreen mode Exit fullscreen mode

vs

// code block starts with just ''' (but with backticks instead of ')
const fn = () => {
  const x = "hello"
  return 3 + x
}
Enter fullscreen mode Exit fullscreen mode

Not sure that makes sense. The parser makes it difficult to explain. Here's a quick GitHub gist that will let you check out the raw text of this comment: Gist

Collapse
 
joachimzeelmaekers profile image
Joachim Zeelmaekers

Oh okay, thanks! Did not know that! 👏

Collapse
 
dvddpl profile image
Davide de Paolis

Wow. Cool suggestion. I do this all the time in Readme files, but never tried on DEV. To