Skip to content

Fix three-level nested list indentation#557

Merged
baynezy merged 6 commits intodevelopfrom
copilot/fix-110
May 28, 2025
Merged

Fix three-level nested list indentation#557
baynezy merged 6 commits intodevelopfrom
copilot/fix-110

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2025

This PR fixes an issue where three-level nested lists were not being indented correctly. Level 3 items were appearing at the same indentation as Level 2 items instead of being properly nested.

Problem

The following HTML:

<ul>
    <li><a>Level 1</a>
        <ul>
            <li><a>Level 2</a></li>
            <li><a>Level 2</a></li>
            <li><a>Level 2</a>
                <ul>
                    <li><a>Level 3</a></li>
                    <li><a>Level 3</a></li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

Was converted to:

*   [Level 1](A/Lorem.htm)

    *   [Level 2](A/Lorem.htm)
    *   [Level 2](A/Lorem.htm)
    *   [Level 2](A/Lorem.htm)

    *   [Level 3](A/Lorem.htm)  <!-- Should be indented more -->
    *   [Level 3](A/Lorem.htm)  <!-- Should be indented more -->

Solution

Fixed two issues in the list processing logic:

  1. Regex pattern fix: Changed \n([ ]*)+(\*|\d+\.) to \n([ ]*)(\*|\d+\.)

    • The original ([ ]*)+ pattern was capturing empty strings instead of actual spaces due to regex group behavior
    • The fixed pattern properly captures indentation spaces for calculation
  2. Removed conflicting indentation: Modified TwoNewLines() replacement to avoid double-indentation

    • Removed extra 4-space indentation that was conflicting with NestedList() indentation logic
    • Let NestedList() handle all indentation consistently

Result

Now produces correctly indented output:

*   [Level 1](A/Lorem.htm)

    *   [Level 2](A/Lorem.htm)
    *   [Level 2](A/Lorem.htm)
    *   [Level 2](A/Lorem.htm)

        *   [Level 3](A/Lorem.htm)  <!-- Correctly indented with 8 spaces -->
        *   [Level 3](A/Lorem.htm)  <!-- Correctly indented with 8 spaces -->
  • ✅ Level 1 lists: 0 spaces
  • ✅ Level 2 lists: 4 spaces
  • ✅ Level 3 lists: 8 spaces (was 4 before)

All existing tests continue to pass, ensuring backward compatibility.

Fixes #110.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits May 28, 2025 10:11
Co-authored-by: baynezy <1049999+baynezy@users.noreply.github.com>
…nd TwoNewLines replacement

Co-authored-by: baynezy <1049999+baynezy@users.noreply.github.com>
Copilot AI changed the title [WIP] List indentation doesn't work Fix three-level nested list indentation May 28, 2025
Copilot AI requested a review from baynezy May 28, 2025 10:34
@baynezy baynezy marked this pull request as ready for review May 28, 2025 11:02
Copy link
Copy Markdown
Owner

@baynezy baynezy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be rebased

Copilot AI and others added 3 commits May 28, 2025 11:12
…559)

Update dotCover tool and command in static analysis workflow

Fixes #558

Co-authored-by: baynezy <1049999+baynezy@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baynezy <1049999+baynezy@users.noreply.github.com>
…iling whitespace in list items

Co-authored-by: baynezy <1049999+baynezy@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2025

This needs to be rebased

Rebased against develop branch in commit 4d70621. Also fixed test failures by trimming trailing whitespace in list items to prevent extra blank lines.

@sonarqubecloud
Copy link
Copy Markdown

@baynezy baynezy merged commit a602406 into develop May 28, 2025
16 checks passed
@baynezy baynezy deleted the copilot/fix-110 branch May 28, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List indentation doesn't work

2 participants