Taken from the small question mark at the top of the input field where there command buttons are situated:
To create preformatted text, indent by four spaces or surround with groups of backticks:
This will be displayed in a monospaced font. The first four spaces will be stripped off, but all other whitespace will be preserved.
Markdown and HTML are turned off in code blocks:
<i>This is not italic</i>, and [this is not a link](https://example.com)
To create not a block, but an inline code span, use backticks:
The $
character is just a shortcut for window.jQuery
.
If you want to have a preformatted block within a list, indent by eight spaces:
This is normal text.
So is this, but now follows a code block:
Skip a line and indent eight spaces.
That's four spaces for the list
and four to trigger the code block.
Adding a language tag to the quoted/backticked code can be achieved like this:
```lang-bash
SELECT * FROM TABLE WHERE COLUMN = 'VALUE';
```
...which will be displayed as:
SELECT * FROM TABLE WHERE COLUMN = 'VALUE';
On Stackexchange code is normally formatted according to the tags and on DBA.SE mostly as lang-sql
, but there may be reasons to use different preformatted text, by overriding the default. A list of supported languages for code formatting can be found in the Q&A What is syntax highlighting and how does it work? (Meta Stackexchange)
Often you might see a combination of quoted and pre-formatted text to display error messages:
This is achieved by adding a > sign followed by 5 spaces and then your text.
Hope this helps.