7

I've seen Blockquote rewrap destroys code, but that question (and answer) are about the situation where a user mistakenly uses the quote button instead of the code button.

I instead want to use both. For example, I might want to quote code from another source (often from the question). If I have some code explicitly enclosed in triple-backticks:

```c
int main(void) {
    printf("Hello world!\n");
}
```

then selecting that and pressing the quote button gives me:

> ```c int main(void) {
>     printf("Hello world!\n"); } ```

I cannot imagine that this is deliberate. I claim that text in triple-backticks should be left alone, and each line instead should just be prefixed with > .

Update:

Trying [the Stacks editor](https://meta.stackexchange.com/questions/360033/opt-in-alpha-test-for-a-new-stacks-editor) in Markdown mode, I seem to get an even worse monstrosity:
 > ```c> c> int main(void) { > {> printf("Hello world!\n");)> ;> }
 > ````> 

(Never mind, that is an unrelated bug.)

6
  • Unable to repro here on MSE, using the new Alpha version of the Stacks editor.
    – Luuklag
    Commented Jun 15, 2021 at 8:23
  • @Luuklag Huh. I just enabled the Stacks editor and tried it, and in Markdown mode, it does still seem to be a problem for me (and actually seems worse; see my edited question).
    – jamesdlin
    Commented Jun 15, 2021 at 8:44
  • The stacks editor only works when composing answers.
    – Luuklag
    Commented Jun 15, 2021 at 8:47
  • 1
    @Luuklag Yes, I know. I drafted an answer to try it, and I got a different result than with the usual editor.
    – jamesdlin
    Commented Jun 15, 2021 at 8:49
  • @jamesdlin So is this talking about the old editor, or the new one, or both?
    – zcoop98
    Commented Jun 15, 2021 at 13:49
  • 1
    @zcoop98 The old editor.
    – jamesdlin
    Commented Jun 15, 2021 at 18:48

1 Answer 1

1

For me this works fine here on Meta Stack Exchange. I copied the code from your quoted block in your question. Posted it here, selected everything, and hit the blockquote button, resulting in this when in markdown mode:

int main(void) {
printf("Hello world!\n");
}

And this when done in rich text mode:

int main(void) {
    printf("Hello world!\n");
}
4
  • 1
    Okay, I am able to reproduce your behavior if I select the code lines with Shift+arrow keys and press the quote button. Oddly, if I press Ctrl+A to select everything and press the quote button, it prefixes lines with > and rewraps all of the lines (and inexplicably sometimes inserts other characters).
    – jamesdlin
    Commented Jun 15, 2021 at 9:17
  • 1
    I just selected with my mouse. The Ctrl + A part is a known bug I think. There must be an answer in the announcement post on the alpha editor that adresses that.
    – Luuklag
    Commented Jun 15, 2021 at 9:19
  • Ah, so it is. Anyway, it doesn't quite leave the triple-backticked text alone in Markdown mode, where it discards indentation. =/
    – jamesdlin
    Commented Jun 15, 2021 at 9:24
  • @jamesdlin Looks like I mentioned this behavior in the bug thread last week. It's not limited to code blocks, Ctrl+A and then quote blocking has weird results no matter what the content is.
    – zcoop98
    Commented Jun 15, 2021 at 13:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .