Skip to content

Fix excessive spacing before lists#253

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-new-line-before-lists
Draft

Fix excessive spacing before lists#253
Copilot wants to merge 4 commits intomainfrom
copilot/fix-new-line-before-lists

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 12, 2026

Description

Lists were rendering with 2 blank lines before them instead of 1. Root cause: MediaWikiListItem prepends a newline, which combined with paragraph trailing breaks (2) produced 3 total newlines.

Solution: Convert the first MediaWikiListItem to MediaWikiText for top-level lists, stripping the automatic leading newline while preserving list formatting.

// For top-level lists, convert first item to avoid automatic leading newline
if (!options?.level && content.length > 0 && content[0] instanceof MediaWikiListItem) {
  const firstItem = content[0];
  const firstItemText = firstItem.build();
  const textContent = firstItemText.startsWith("\n") ? firstItemText.slice(1) : firstItemText;
  content[0] = new MediaWikiText(textContent);
}

Before:

meaning:


* Players could buy them...

After:

meaning:

* Players could buy them...
Original prompt

This section details on the original issue you should resolve

<issue_title>Unnecessary new line before ordered/unordered list</issue_title>
<issue_description>News link: https://secure.runescape.com/m=news/getting-around?oldschool=1

Unordered/Ordered lists have a new line before the list:

Actual:

If this proposal passes, both the Red and Blue Rum would become tradeable, meaning:


* Players could buy them from other players or via the Grand Exchange.
* Players who regularly play Trouble Brewing could sell spare rum from the rewards shop.

Expected:

If this proposal passes, both the Red and Blue Rum would become tradeable, meaning:

* Players could buy them from other players or via the Grand Exchange.
* Players who regularly play Trouble Brewing could sell spare rum from the rewards shop.
```</issue_description>

<agent_instructions>The parser is `listParser`</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💡 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 changed the title [WIP] Fix unnecessary new line before ordered/unordered lists Fix excessive spacing before lists Jan 12, 2026
Copilot AI requested a review from allenkinzalow January 12, 2026 14:22
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.

Unnecessary new line before ordered/unordered list

2 participants