Let's say I want to quote this shell code in a post:
foo=bar
echo $foo
First I put it in code fences so it shows up as code:
```sh
foo=bar
echo $foo
```
Then to quote it, I select it and either press the Blockquote button or Ctrl+Q, but the newlines get converted to spaces, destroying it:
> ```sh foo=bar echo $foo ```
I would expect it to output this:
> ```sh
> foo=bar
> echo $foo
> ```
Which renders as:
foo=bar echo $foo
This issue does not affect text indented by four spaces.
Workaround
Use <blockquote>
, though the start tag requires an extra newline, like this:
<blockquote>
```sh
foo=bar
echo $foo
```
</blockquote>
Which renders as:
foo=bar echo $foo
As an added bonus, this usually results in a smaller diff when editing, since the quote button rewraps text, but this doesn't of course.
Also affects
Quoting text in HTML tags
For example, <pre>
:
<pre>
foo
bar
</pre>
becomes:
> <pre> foo bar </pre>
Putting code fences into a list (bulleted or numbered)
List this
```
foo
bar
```
becomes:
- List this
``` foo bar ```
or
3. List this
``` foo bar ```
Context
I noticed this while adding content to this answer and experienced the same problem while quoting the code in this question.