Skip to content

Printer: Also fully reconstruct whitespace in HTMLCloseTag#443

Merged
marcoroth merged 1 commit intomainfrom
printer-close-tag-whitespace
Aug 25, 2025
Merged

Printer: Also fully reconstruct whitespace in HTMLCloseTag#443
marcoroth merged 1 commit intomainfrom
printer-close-tag-whitespace

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Aug 25, 2025

This pull request updates the IdentityPrinter to also reconstruct the whitespace in the HTMLCloseTag.

The parser was already adding the WhitespaceNodes to the children array of the HTMLCloseTag (done in #396), but the IdentityPrinter wasn't accounting for them.

Now these templates can also be fully reconstructed using the IdentityPrinter:

<div></   div>
<div></div   >
<div></   div   >

Additionally, this pull request also adds some more AST helpers to the @herb-tools/core package to select nodes before/after a certain Location or Position.

@marcoroth marcoroth added feature New feature or request printer labels Aug 25, 2025
@marcoroth marcoroth merged commit d3b3632 into main Aug 25, 2025
7 of 8 checks passed
@marcoroth marcoroth deleted the printer-close-tag-whitespace branch August 25, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request printer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant