Let's say I want to quote this shell code in a post:

echo $foo

First I put it in code fences so it shows up as code:

echo $foo

Then to quote it, I select it and either press the Quote button or Ctrl+Q, but the newlines get converted to spaces, destroying it:

> ``` foo=bar echo $foo ```

I would expect it to output this:

> ```
> foo=bar
> echo $foo
> ```

This also affects text in <pre> tags, but not text indented four spaces.

For context/a real life example, I noticed this while editing this answer to add text from this Github README.md.

  • 8
    You can use indentation instead of code fences as a workaround. I mean Ctrl+K and then Ctrl+Q. – L. F. Jul 1 at 2:23
  • 10
    But please dont ise a code fence on an already indented post. – Luuklag Jul 1 at 5:31
  • 2
    Can I quote you on your code snippet demonstrating a quoted code snippet? – Dave Jul 2 at 17:39
  • @Dave Sure but you'll have to put it in a quoted code snippet :P – wjandrea Jul 2 at 17:42

You must log in to answer this question.

Browse other questions tagged .