A one-line list
- HTML markup
- <ul><li>A</li><li>B</li></ul>
- Indent with
- 2 spaces
Result Formatted HTML: <ul>
<li>A</li>
<li>B</li>
</ul>
Elements: 3
Lines: 4
Deepest nesting: 1
Comments: 0
Input characters: 29
Output characters: 36
- Split the markup into 8 tokens: tags, comments and text runs.
- Placed each block on its own line, indented 2 spaces per nesting level; void elements such as br and img do not open a level.
- An element holding only short text stays on one line; pre, textarea, script and style contents are kept as written.
Each list item moves to its own line, two spaces in, and stays on one line because it holds only short text.