Here is how to copy and paste code so it appears as code


(Blu McCormick) #1

A dilemma is that if you quote code directly using the block quote function it appears as what it is coding for.

To solve this:

a0b5340b7a32beeb8f515dce0115c033734d9db9_1_690x257

Tap the blue key three times to open a code block and press enter to get to the next line.

Copy-paste / write the code you want to use.

Press enter for a new line again.

Then tap the blue key three times again to close the code block.

Credit to lll for the instructions. Thanks, @lll.


(Blu McCormick) #2

Apparently, we can ask to have this made into a wiki. If this is useful to you, please let me know, and I’ll make the request.


(Mittineague) #3

One question. What if the keyboard isn’t a standard QWERTY and lacks the backtick key?


(Blu McCormick) #4

Good question, Mittineague.

Here is one solution I found for when you do not have the backtick key displayed on your keyboard.


(Gerhard Schlager) #5

You can also indent each line of the code block with 4 spaces. See Markdown Tutorial - Code for more on that.

Another solution is to use the composer’s toolbar button. Select the text that should be formatted as code block and press the button.
image

Depending on the value of the code_formatting_style site setting this either indents with 4 spaces or uses backticks to format the code block.


(Jeff Atwood) #6

It’s easiest to use the toolbar button as indicated above. You don’t need to find the ` key on the keyboard.


(Christoph) #7

I’d assume most keyboard layouts have it, though it may well be in a different place (and require the use of shift or alt gr, or it is a dead key requiring you to press it six instead of three times). But you can also use ~.