Markdown – Do you set the language on code blocks?

Last updated by Brook Jeynes [SSW] 10 months ago.See history

You should have a syntax highlighter to show pieces of code on your pages for a better readability.

Examples:

See this json file for all supported languages and their aliases we can use in SSW Rules.

let iceCream = 'chocolate';

if (iceCream === 'chocolate') {
  alert('Yay, I love chocolate ice cream!');    
} else {
  alert('Awwww, but chocolate is my favorite...');    
}

Figure: Bad example - No syntax highlighting

let iceCream = 'chocolate';

if (iceCream === 'chocolate') {
  alert('Yay, I love chocolate ice cream!');    
} else {
  alert('Awwww, but chocolate is my favorite...');    
}

Figure: Good example - This JavaScript code block shows its syntax highlighted

We open source. Powered by GitHub