mathdown icon indicating copy to clipboard operation
mathdown copied to clipboard

List assist

Open cben opened this issue 10 years ago • 2 comments

Getting lists right is tricky for markdown newcomers.

  • Enter should probably continue list item; second Enter would start new item; third Enter would close list.
  • List items should auto-indent so text (not bullet) is aligned to multiple of 4 spaces, so continuation lines can line up nicely. Reindent when typing - ("electric"), on Enter, or both?
  • Tab/Shift+Tab when notheng is selected should affect whole paragraph / list item (incl. sub-items) etc.

Steal ideas from Stack Exchange?

http://meta.stackexchange.com/a/56430/204832 Actually Shift+Enter is a continue formatting command: I.e. it doesn't continue extra indenting within code, but it does add the first 4 needed spaces if you're already in code. It also adds the next numeric value for a numbered list, a copy of the first mark for an unnumbered list, and for both of the latter it "fixes" the other numbers/marks to be sequential/the same. It also continues > blockquotes. – Mark Hurd Jul 10 '10 at 3:16

Only consider doing all that on unshifted Enter?

cben avatar Apr 18 '14 07:04 cben

https://workflowy.com is probably the best list editor currently on the web. Copy their shortcuts. (but they do Enter for new item and Shift+Enter for smaller-font continuation — seems their model of items is "title + optional body")

cben avatar Jun 19 '14 14:06 cben

There are 2 ways to line up list text with continuation lines:

Spaces before bullet:

  + A
  + B

or

 1. A
 2. B

Spaces after bullet:

*   A
*   B

or

1.  A
2.  B

For some reason I've always only considered the first way but I now see Gruber's markdown doc uses the second in all examples.

Both parse exactly the same in markdown. The second has the marginal benefit of also parsing right as reStructuredText (not as list inside blockquote) but that doesn't matter to mathdown users. (I simply have a soft spot for reST having spent a few years on the docutils mailing list.)

Will have to pick preferred one for the user. Or maybe not?

  1. For first style, I should make -+*. and/or space electric, and as soon as you type - the line will snap 2 spaces right. Users preferring 2nd style will have a hard time. Although it's possible to let user type more spaces after bullet and shift bullet to the left correspondingly.
  2. For second style, you may type spaces before the bullet, or not; then as soon as you type the bullet the remaining spaces are inserted, moving the cursor to column 4.

So I can make sure that fully typing * or * works as desired either way; the difference is what style you get when you only type *.

cben avatar Oct 01 '14 18:10 cben