Skip to content

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Dec 26, 2025

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes an issue where HTMLRenderer could not correctly handle nested lists. The changes introduce indentation tracking and modern switch expression syntax to improve code readability and maintainability.

Key Changes

  • Added indentation level tracking with indentationLevel field to properly handle nested list rendering
  • Introduced INDENTATION constant for consistent spacing (4 spaces)
  • Refactored switch statements to use modern Java switch expressions with arrow syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


private void appendText(String text) {
if (indentationLevel > 0) {
text = text.replaceAll("\n", INDENTATION.repeat(indentationLevel) + "\n");
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The regex replacement pattern has the indentation in the wrong position. Currently, replaceAll("\n", INDENTATION.repeat(indentationLevel) + "\n") replaces newlines with indentation + \n, which places the indentation before the newline character. This means the indentation appears at the end of each line rather than at the beginning of the next line. The replacement should be "\n" + INDENTATION.repeat(indentationLevel) to properly indent the text that follows each newline.

Suggested change
text = text.replaceAll("\n", INDENTATION.repeat(indentationLevel) + "\n");
text = text.replaceAll("\n", "\n" + INDENTATION.repeat(indentationLevel));

Copilot uses AI. Check for mistakes.
@Glavo Glavo closed this Jan 2, 2026
@Glavo Glavo deleted the html-list branch January 2, 2026 08:23
@zkitefly
Copy link
Member

zkitefly commented Jan 2, 2026

怎么关闭了?

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

Successfully merging this pull request may close these issues.

2 participants