howToCodeWell/how-to-ask-a-question

Add code block documentation

pfwd opened this issue · 0 comments

pfwd commented

From pinned message in the coding-help channel:

Formatting code when asking for code help

Please write your code in a code block.

  1. Single lines/words/inline code.

Wrap the code in single back ticks like this:
$this->isWrappedInSingleBackTicks()

  1. Multiple lines:

Wrap multiple lines of code in three back ticks like this:

function thisIsWrappedInThreeBackTicks() {
         return [
                'formatted_code' => 'is_easier_to_read'
        ]
}
  1. Highlight your syntax

Add the programming language to the first back ticks ````php ```` like this:

function thisIsWrappedInThreeBackTicks() {
         return [
                'formatted_code' => 'is_easier_to_read'
        ]
}

Or ````css ````

.howToCodeWell{
   display:block
}

Or ````js ````

const website = howtocodewell.net
const podcast = howtocodewell.fm

console.log(website)
console.log(podcast)
  1. To create a new line hold down shift and press enter. Holding the shift key will prevent the message from being sent and it will put your cursor on the next line.