question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

change order of list items introduces an unnecessary space for "9."

See original GitHub issue

What is the problem?

I have a markdown file with a numbered list of items. When changing the order using Alt-Up/Down it works fine and automatically renumbers, but when the item I am moving passes from 9 to 10 there is an extraneous space left after “9.”, making it two spaces and that is getting caught by markdown lint.

How can I reproduce it?

  1. Create an ordered list with at least 10 items.

List now may look like this:

1. a
2. b
3. c
4. d
5. e
6. f
7. g
8. h
9. i
10. j
  1. Move item 9 one step down (i.e. switch place with the 10th item). Notice an extra space has been added after “9.” making the list look like this:
    1. a
    2. b
    3. c
    4. d
    5. e
    6. f
    7. g
    8. h
    9.  j
    10. i

Is there any error message in the console?

No

I’m using 2019.07.21.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Lemminghcommented, Dec 27, 2019

I’d like to add 2 test cases. I think it’s pretty possible that someone embeds a code block into a list item. (| means cursor)

This test covers the case that the content of the previous list item is an indented code block:

<!-- Right after moving line 10 up -->
8.     eight
10. ten|
9. nine

<!-- Renumber -->
8.     eight
9. ten|
10. nine

This test covers the case that the content of the current list item is an indented code block:

<!-- Right after moving line 10 up -->
8.  eight
10.     ten|
9.  nine

<!-- Renumber -->
8.  eight
9.     ten|
10. nine

@yzhang-gh , would you please create some labels, such as Area-List, Area-Math, Area-TOC, Area-Preview-and-Print, Area-SyntaxHighlighting, Area-IntelliSense-and-Completion, to sort issues by area (subject or related function)? I believe that issues in the same area are related in some aspect. And if we get them together, we can possibly find the cause of a problem more accurately.

Besides, it would be nice to have a label called “resolved” to mark those are fixed in dev build but haven’t been released.

0reactions
wolf99commented, Sep 16, 2021

I have seen the same problem today. It causes markdownlint to mark the affected lines with multiple errors

Use case:

  1. Create an ordered list with >= 10 items
  2. Delete one of the items at index < 10
  3. List item indexes are correctly updated, but the spacing is not
  4. Markdownlint marks this as multiple errors:
    • MD030/list-marker-space: Spaces after list markers [Expected: 1; Actual: 2] markdownlint (MD030)
    • MD032/blanks-around-lists: Lists should be surrounded by blank lines markdownlint (MD032)

I haven’t checked, but if the same logic is used for all index magnitude indenting then the issue will be repeated at list index 100 and list index 1000.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove the space between list items - Stack Overflow
Inline elements are rendered with spacing between them whenever there's whitespace in your code. This is a good thing when it comes to...
Read more >
Rearrange an array in maximum minimum form | Set 2 (O(1 ...
Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, ...
Read more >
How to Create Custom List Numbers in Microsoft Word
Chapters: 00:00 Introduction 01:14 How to Create Custom List Numbers 03:38 How to Remove Extra Space between List Numbers and List Items ......
Read more >
4 Ways To Replace Items In Python Lists | by AnBento
Introduction. While preparing for your next Python coding round, you might have noticed that algorithms requiring to manipulate one or more ...
Read more >
How to Write Run-In Lists
Semicolons can separate run-in list items with internal commas. 2 ... (1) “How to Delete Extra Spaces in Microsoft Word,” (2) “How to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found