An Illustrated Guide To Formatting Code In Chat
- Last edited on Apr 11, 2019, 5:15:08 PM by Kevin
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.
Click for example
Formatting an entire multi-line message as code
Every line of your message must be indented with four spaces.
You can use the keyboard shortcut, ctrl-k. Make sure the text box has keyboard focus first.
Click for example
Or you can use the “fixed font” button. This button only appears when the text box contains more than one line of code.
Click for example
Or you can add the spaces manually.
Click for example
Common issues
Trying to use backticks or triple backticks in a multiline message. This does not work. Backticks only work in single line messages.
Click for example
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.
Click for example
Indenting only the non-empty lines of your message. This does not work. Every line must be indented, including empty lines.
Click for example
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.