Renumbering ordered lists

I’d like to see a feature to renumber ordered lists.

I recognize it doesn’t matter when rendered, but this would be useful for exporting to non-markdown tools, as well as making it easier to manage when editing a list.

Currently, we can use any number when inserting an item, and that (mostly) works, but it would be very nice to then be able to have an option to renumber the whole list.

For example:

1. This
2. is
3. a
4. list

might become:

1. This
2. is
3. a
4. longer
4. list
5. now

At this point, I’d like to select the list and use a hotkey/button/menu item to make it:

1. This
2. is
3. a
4. longer
5. list
6. now

Hi I edited your post to put the markdown lists in code blocks. Discord is also markdown based so both lists rendered the same…

I like this idea, I think it could probably be wrapped up in a generic auto format function. For example you could select a block of markdown, right click and autoformat that selection. It would hopefully work for lists, tables, generic whitespace.

Thanks! That’s what I get for not previewing my post.

I like that approach. I certainly wouldn’t want to make this a default auto-format. I imagine that would break a lot of workflows.

I give a hearty +1. I would truly love to see this implemented.

Just a friendly reminder: markdown does not care about the numbers. e.g.

1. item1
1. item2
3. item3

and

1. item1
2. item2
3. item3

both render the same. The preview window will show it correctly.

However, I do understand that you want to have a correct numering in the source as well. Although I believe this is not in the scope of this project. Maybe someone can create a plugin for that.

1 Like

There's a plugin demo on how to retrieve the selected text, apply some transformation and insert back the text: https://github.com/laurent22/joplin/blob/dev/packages/app-cli/tests/support/plugins/selected_text/src/index.ts

The same logic could be applied to the currently selected list items.