Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.45k stars 319 forks source link

Adding list inside block quote is incorrect #138

Closed gkubisa closed 4 years ago

gkubisa commented 4 years ago

Describe the bug When editing a block quote and clicking an ordered (or unordered) list button, the list markers are added before the block quote markers, instead of after.

To Reproduce Steps to reproduce the behavior:

  1. Type > and leave the cursor at the end of the line.
  2. Click on the unordered list button.

Expected behavior The text in the editor should be > *.

Actual behavior The text in the editor is * >.

Version information

Ionaru commented 4 years ago

It seems editors disagree on how it should work, GitHub's editor for example puts the list on a next line.

* > is technically not wrong, you can have a quote as a list item 🤷‍♂ Why is > * the "correct" way?

gkubisa commented 4 years ago

I agree - both are technically correct and I can't see an objective reason to prefer one over the other. Thanks for looking into it.

shaunakennedy commented 4 years ago

It's just my two cents, but I would argue that if a user wanted * > then they would click on the list button in the editor and then the quote. If a user wishes to have a quote included as part of a list, the natural process for this would be to click the list button (unordered or numbered) and then the quote. Doing this however produces > 1. which is a list inside a quote, which is not what is expected. The current behaviour is doing the opposite of what would be expected. Clicking on the editor buttons should produce markdown in the order which the user clicked, instead the markdown produced is backwards.

* > is technically not wrong, you can have a quote as a list item

Yes, it is not technically wrong, and you can quote as a list item, but it is not what the user intended to do. If I click on Quote and then the list button, it is because I want a list item as quoted.

Why is > * the "correct" way?

In this instance, it is the "correct" way because that's what the user intended. They clicked on > (Quote button) and the (list button) as they wanted a list inside a quote. It is as the user intended, and displaying it the opposite way is frustrating for the user. If they wanted > then that is exactly what they would have clicked.