yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.91k stars 322 forks source link

Renumber list items #32

Closed borekb closed 6 years ago

borekb commented 7 years ago

Quite a common use case for me is moving items in ordered lists. In the end, I might end up with something like:

1. Lorem ipsum
3. Dolor sit amet
2. Etc.

This obviously gets much worse in larger lists, e.g., instructions for something. It would be nice if the numbering could be fixed automatically by this extension.

yzhang-gh commented 7 years ago

A smart solution is always using 1. as list marker. See discussion here.

borekb commented 7 years ago

I personally prefer real numbering as that makes raw markdown more readable (I not always read the rendered HTML version). This extension already has code to support natural numbering so hopefully it can be expanded to the scenario I've described above. Thanks for considering it anyway.

yzhang-gh commented 7 years ago

Yes, it's a good enhancement.

But it seems that currently there isn't any available API for us to listen to the reorder event. An alternative solution is providing a command format ordered list.

Any suggestion?

borekb commented 7 years ago

Explicit command is perfectly fine for me. 👍

yzhang-gh commented 7 years ago

Will have a try when I get some free time

Gruntfuggly commented 6 years ago

I'd like auto renumbering too please. 8-)

Yalhu commented 6 years ago

On preview,I want to show the number what I used . Not renumber from 1.

// code
1. list1
2. list2 
some desc ..
3. list3
4. list4
some description ..
5. list5

Preview: the origin what I want

  1. list1
  2. list2

some description ..

  1. list3
  2. list4

some description ..

  1. list5

Preview now: I don't want

  1. list1
  2. list2

some desc ..

  1. list3
  2. list4

some description ..

  1. list5

Can this work?

yzhang-gh commented 6 years ago

I cannot reproduce on my PC (Windows 10, VSCode v1.22.0-insider)

image

I guess you have other MD extension installed?

Yalhu commented 6 years ago

Sorry ,my fault. I generate a localhost page displaying that via hexo server.

yzhang-gh commented 6 years ago

Please try v1.2.0-fix32. Works like a charm ✨

willhains commented 1 year ago

@yzhang-gh 👋 I found this doesn't work in the following cases: