-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I plan to revamp the HTML Pretty Printer. The current implementation is spread out through all the Node hierarchy, and is very brittle. Each different node type needs to understand the rules of the other types so they can print appropriately, and this has lead to some grotesque code.
To revamp I would centralize it into a specific consolidated function, that will take the node and a context. The context object can track stack related properties (as in, are we descended from a white-space sensitive element; is there any meaningful content already emitted at this level, etc).
This can also integrate with the changes in #2285 Custom Tags, so folks can specify their own properties.
We can also add some more configuration on the overall print (e.g. a tag list of "don't indent") so that body and head and their direct children don't need to be indented.
I also plan on simplifying the rules such that by default, a block tag only ever indents its children if one of those is also a block.