How the formatter decides where lines break
The formatter reads your HTML into a tree of elements, then prints it back with one level of indentation per nesting depth. Three rules keep the result readable without changing how the page renders:
- Block containers such as
,,
put each child on its own line.- Inline content stays together. When an element holds only text and inline elements (
a,strong,em,code,span,imgand similar), it is printed on a single line, for example. Splitting those onto separate lines would insert visible spaces between words and links.Total: $42
- Void elements defined by the HTML standard (
br,img,input,meta,link,hrand others) never get a closing tag or an extra indent level.
Runs of spaces and newlines in normal text collapse to one space, which is exactly how browsers render them. Attributes are kept as you wrote them, and quoted values that contain > are handled correctly. Formatting is idempotent: running the output through again produces the same text.