13

I'm not sure what makes the blockquote formatting button so attractive to new users but they sure do love to use it for code.

The problem is, an editor trying to fix it by selecting the problem block of text and hitting the blockquote button to remove the quotes also destroys the newline formatting.

For example, say we start with this (a common occurrence in my experience)

> <!doctype html>
> <html lang="en">
>   <head>
>     <title>My HTML page</title>
>   </head>
>   <body>
>     <h1>My HTML page</h1>
>   </body>
> </html>

Selecting and hitting the button results in this

<!doctype html> <html lang="en">   <head>
    <title>My HTML page</title>   </head>   <body>
    <h1>My HTML page</h1>   </body> </html>

Is there any chance we could have the button simply toggle the leading > characters on each line and nothing else?


As an aside, I found a similar thing happens when adding blockquotes. Take the same sample above

<!doctype html>
<html lang="en">
  <head>
    <title>My HTML page</title>
  </head>
  <body>
    <h1>My HTML page</h1>
  </body>
</html>

Selecting it and clicking the blockquote button has a similar effect

> <!doctype html> <html lang="en">   <head>
>     <title>My HTML page</title>   </head>   <body>
>     <h1>My HTML page</h1>   </body> </html>
2
  • The old & new (wysiwyg) editors are messes when it comes to markdown semantics. (Ironic given the point of markdown is implicit & annotated semantics.) PS Unfortunately new users also get access to links to images.
    – philipxy
    Commented Oct 24, 2023 at 0:22
  • 1
    @philipxy this is just the plain old markdown editor. I'd give up editing questions entirely if I was forced to use the new editor. I suspect this is an issue with whatever regex is used to detect the start of each line and the replacement logic used to insert / remove characters
    – Phil
    Commented Oct 24, 2023 at 0:25

1 Answer 1

2

This answer only attempts to describe the current behavior of blockquote that makes this issue happening. Note that as of current, there's no 1-click solution to fix the issue mentioned in the question.


When someone selects a paragraph and then click the blockquote button, this is what happens:

  1. Select a paragraph
  2. Click the blockquote button
  3. If the paragraph spans multiple lines, then it will be broken into multiple new lines
  4. Each line then will be appended with >

Thus, the following paragraph:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed volutpat mi ex, vel luctus eros pulvinar et. Praesent risus augue, efficitur non magna quis, egestas varius enim. Vestibulum dapibus, velit et tempus porta, felis nunc dignissim nulla, non efficitur eros ipsum sit amet ligula. Praesent in odio accumsan, hendrerit magna at, scelerisque felis. Quisque viverra in augue a bibendum. Quisque id efficitur quam, eu lobortis tellus. Sed nunc est, sagittis eu odio non, finibus scelerisque risus. In quis ultricies sapien. Nulla et augue purus. Vivamus sit amet est non nibh condimentum tempus. Morbi varius, dolor a ullamcorper porttitor, orci lorem convallis tortor, aliquet malesuada tortor nulla id nisl.

Will be quoted as

> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed volutpat
> mi ex, vel luctus eros pulvinar et. Praesent risus augue, efficitur
> non magna quis, egestas varius enim. Vestibulum dapibus, velit et
> tempus porta, felis nunc dignissim nulla, non efficitur eros ipsum sit
> amet ligula. Praesent in odio accumsan, hendrerit magna at,
> scelerisque felis. Quisque viverra in augue a bibendum. Quisque id
> efficitur quam, eu lobortis tellus. Sed nunc est, sagittis eu odio
> non, finibus scelerisque risus. In quis ultricies sapien. Nulla et
> augue purus. Vivamus sit amet est non nibh condimentum tempus. Morbi
> varius, dolor a ullamcorper porttitor, orci lorem convallis tortor,
> aliquet malesuada tortor nulla id nisl.

Instead of

> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed volutpat mi ex, vel luctus eros pulvinar et. Praesent risus augue, efficitur non magna quis, egestas varius enim. Vestibulum dapibus, velit et tempus porta, felis nunc dignissim nulla, non efficitur eros ipsum sit amet ligula. Praesent in odio accumsan, hendrerit magna at, scelerisque felis. Quisque viverra in augue a bibendum. Quisque id efficitur quam, eu lobortis tellus. Sed nunc est, sagittis eu odio non, finibus scelerisque risus. In quis ultricies sapien. Nulla et augue purus. Vivamus sit amet est non nibh condimentum tempus. Morbi varius, dolor a ullamcorper porttitor, orci lorem convallis tortor, aliquet malesuada tortor nulla id nisl.

Thus, when trying to reverse the blockquote...

  1. The > on each line is removed
  2. Remove each new line
  3. Inline them

Which, when applied to a paragraph, probably makes sense, but not for code...


Note: the new Stacks Editor only appends a single > on the beginning without breaking them into multiple new lines, but it doesn't help when trying to undo blockquoted code.

1
  • I found it also removes newlines when adding blockquotes
    – Phil
    Commented Oct 24, 2023 at 4:14

You must log in to answer this question.

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