Skip to content

libghostty(formatter): fix superfluous newline in html formatting - #13543

Merged
mitchellh merged 2 commits into
ghostty-org:mainfrom
RoniJacobson:formatter-html-superfluous-newline
Aug 2, 2026
Merged

mitchellh merged 2 commits into
ghostty-org:mainfrom
RoniJacobson:formatter-html-superfluous-newline

Conversation

@RoniJacobson

Copy link
Copy Markdown
Contributor

In the html formatter every page is formatted in a div. When the div closes it causes a newline in the html rendering. In order to fix this a newline is now removed whenever the div is closed (if there are any newlines waiting to be rendered - as far as I could see in my testing there was always one).

I thought of trying to add a test but could not think of a way to do so without adding a massive blob of html into the file.

Before (orange was added by me to show where the div ends):
image

After:
image

No AI was used in this pr.

Every page is formatted in a div, and when the div closes it creates a newline in the html rendering.
In order to fix this a newline is now removed whenever the div is closed (if there are any newlines waiting to be rendered).
@RoniJacobson
RoniJacobson requested a review from a team as a code owner August 1, 2026 19:14

@jcollie jcollie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs a test. Not sure what you mean by "massive blob" but that's what @embedFile is for. If it's only referenced in a test it won't affect the size of the production binary.

@RoniJacobson

Copy link
Copy Markdown
Contributor Author

I initially thought I would have to include the whole html page I showed in my screenshots for the test, but after taking another look I realized it was just a matter of using the PageFormatter itself for the test :)

@RoniJacobson
RoniJacobson requested a review from jcollie August 1, 2026 23:58

@jcollie jcollie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved pending CI

@jcollie
jcollie enabled auto-merge August 2, 2026 01:05
@RoniJacobson

Copy link
Copy Markdown
Contributor Author

Looks like ci has passed but the merge didn't work?

@mitchellh
mitchellh disabled auto-merge August 2, 2026 14:03
@mitchellh
mitchellh merged commit 915496c into ghostty-org:main Aug 2, 2026
98 checks passed
@github-actions github-actions Bot added this to the 1.4.0 milestone Aug 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.

3 participants