Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to have ordered list use only '1. ' instead of enumerating #587

Closed
bklaase opened this issue Jan 20, 2021 · 2 comments
Closed

Comments

@bklaase
Copy link

bklaase commented Jan 20, 2021

Almost all markdown viewers/renderers allow for the use of "1. " to denote a numbered list. so instead of

1. item1
2. item2
3. item3

one can write

1. item1
1. item2
1. item3

which will then renders as:

1. item1
2. item2
3. item3

Examples that implement this behavior are sphinx / readthedocs, github, emacs markdown preview, etc. I strongly prefer this option since when people reshuffle their ordered lists, and they don't have a nice editor, they can't make mistakes.

I looked at the code of markdown-insert-list-item and on line 6040 is the relevant part:

            (let* ((old-prefix (match-string 1))
                   (old-spacing (match-string 2))
                   (new-prefix (if old-prefix
                                   (int-to-string (1+ (string-to-number old-prefix)))
                                 "1"))

changing the check just for old-prefix and adding a check for a configuration option that could be named:
markdown-ordered-list-item-prefix-enumeration (default t, and when nil doesn't enumerate, but always inserts "1. ") would be exactly the behavior I am looking for.

Would this be acceptable?

@syohex
Copy link
Collaborator

syohex commented Jan 20, 2021

Would this be acceptable?

Yes. Welcome PR.

@bklaase
Copy link
Author

bklaase commented Jan 20, 2021

it's a very simple change, but make test:

Ran 495 tests, 492 results as expected, 0 unexpected, 3 skipped (2021-01-20 20:25:37+0100, 4.114589 sec)
1 expected failures

@syohex syohex mentioned this issue Jan 21, 2021
5 tasks
@syohex syohex closed this as completed in 6eea736 Jan 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants