Rules

Secret ingredients to quality software

Edit
Info

Markdown – Do you set the language on code blocks?

Last updated by Brad on 30 Mar 2021 10:45 pm (4 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: This JavaScript code block shows its syntax highlighted

SSW CodeAuditor enforces this rule https://codeauditor.com/rules

When the CodeAuditor box is ready, update the greybox above. https://github.com/SSWConsulting/SSW.Rules/issues/417

Adam CoganAdam Cogan

We open source. This page is on GitHub