As alluded to in the comments by Martin Sleziak, there are a few ways of creating code blocks:
Inline code (for code that does not contain newlines)
- When the cursor is not in the first column, or you've selected code that does not hold newlines, click the
{}
code button above the
editor (pictured below) or hit Ctrl+K
(Cmd+K on macOS)
- Enclose with backticks:
`<html>`
- Embed within
<code>
tags, and manually encode HTML entities: <code><html></code>
Blocks of code (preserves newlines)
- When the cursor is on an empty line, or you've selected code including a newline, click the
{}
code button above the editor
(pictured below) or hit Ctrl+K
(Cmd+K on macOS)
- Create code fences with three backticks
```
or tildes ~~~
, one on a line before the code, and one on a line after
- Indent the code by four spaces
- Encase in
<pre>
or <pre><code>
tags (in that order; using <code><pre>
is invalid), and encode HTML entities (like <
for <
) yourself
All of these seem to work on my system.
Regarding the {}
icon:
I don't know that you can (or should) expect anything more. The goal here is to make it easy to input text with a fairly restricted number of (syntactic) formatting options. Code blocks are indicated by leading spaces. Those spaces can be inserted in a number of ways but, at the end of the day, they need to be there if you want a code block.
\begin{align}...\end{align}
,\begin{array}...\end{array}
and even$$...$$
(this last one is special to mathjax, does not work in LaTeX) supports multi-line output with two slashes \\. Text can be forced into Mathjax with\text{...}
$\endgroup$$...$
,$$...$$
or\begin{...}...\end{...}
pairs. Without these things, Mathjax is not used, so it is not possible to ask Mathjax to do anything. In contrast, your example displays a code block, and does not use any Mathjax. $\endgroup$