An Illustrated Guide To Formatting Code In Chat
- Last edited on Aug 16, 2017, 2:41:39 PM by poke
Embedding code in a single line of plain text
put a backtick character on either side of your code. This only works if your message is one line long.
Formatting an entire multi-line message as code
Every line of your message must be indented with four spaces.
This can be done manually.
Or it can be done with the “fixed font” button. This button only appears when the text box contains more than one line of code.
Or you can use the keyboard shortcut, ctrl-K. Make sure the text box has keyboard focus first.
Trying to use backticks in a multiline message. This does not work. Backticks only work in single line messages.
Indenting only the lines of your message that you intend to be code. This does not work. Every line must be indented; you can’t mix plaintext and code in a multi-line message.
Indenting only the non-empty lines of your message. This does not work. Every line must be indented, including empty lines.
Try it out!
Want to experiment with these techniques, but don’t want to bother users already talking in a programming room? You can use the Sandbox room.