lemmy-ui icon indicating copy to clipboard operation
lemmy-ui copied to clipboard

The quote button doesn't treat a block of highlighted independent lines differently than a block of highlighted mulitline word-wrapped text

Open K4LCIFER opened this issue 5 months ago • 1 comments

Requirements

  • [X] This is a bug report, and if not, please post to https://lemmy.ml/c/lemmy_support instead.
  • [X] Please check to see if this issue already exists.
  • [X] It's a single bug. Do not report multiple bugs in one issue.
  • [X] It's a frontend issue, not a backend issue; Otherwise please create an issue on the backend repo instead.

Summary

TL;DR When you click the quote button, image, with text highlighted (where [ represents the start of a highlight selection, and ] represents the end of a highlight selection), the following text

[text

text]

is formatted as

>text

text

where it should instead be formatted as

>text
> 
>text

When you click the quote button with higlighted text that contains multiple independent lines, it will only place the quote icon, > on the first line, and it will ignore the following lines.

In markdown, an empty line after a quote turns off the quote. You can have mulitple lines in a quote block, but they must immediately follow each other. If you want independent lines to be quoted as one block, the empty line that separates them must also be quoted For example:

> text
text

is formatted as

text text

> text

text

is formatted as

text

text

> text

> text

is formatted as

text

text

> text
> 
> text

is formatted as

text

text

When I click the quote button with highlighted text, I expect that entire block of highlighted text will be turned into one quote block, no matter how many blank lines are contained within the higlhight selection. I think the quote button is treating all highlighted blocks as if they were the first example, so it thinks that it only needs the one >. But, what should be happening is that the empty lines within the selection should have a > added at their beginning to contain them within the quote.


Aside, for the sake of prettier text, it woulod be nice if a single space was added after the quote sympbol, >. As in, instead of

text

being formatted as

>text

it would be nice if it was instaed formatted as

> text

Steps to Reproduce

  1. Create a new post/comment to open the editor
  2. Into the editor type the following
text

text
  1. Highlight all of the text with a highight selection
  2. Click the "quote" button, image.
  3. Observe that the text is replaced with
>text

text

Technical Details

  • OS: Arch Linux, Kernel v6.7.0-arch3-1
  • DE: KDE Plasma v5.27.10
  • Browser: Firefox v121.0.1 (installed from the Arch Linux official repos)

Lemmy Instance Version

0.18.5

Lemmy Instance URL

sh.itjust.works

K4LCIFER avatar Jan 19 '24 02:01 K4LCIFER

Regarding the "Aside", one edge case with this could be nested quotes. It would be quite ugly if text gets formatted as

> > > > text
> > > 
> > > text

for example. Instaed, it would be best if it takes into account the fact that there already exists a quote, and then doesn't add the extra space. So, the above text should instead look like

>>>> text
>>>
>>> text

K4LCIFER avatar Jan 19 '24 02:01 K4LCIFER