lua-htmlparser icon indicating copy to clipboard operation
lua-htmlparser copied to clipboard

Add text nodes

Open remysucre opened this issue 2 months ago • 2 comments

This PR adds text content as children nodes to the parent node, e.g. <p>Hello<br>World</p> will parse to a p node with 3 children: a text node containing Hello, the br node, and a text node containing World. A text node has nil as its tagname (because it has no tagname), but we can discuss this choice. The added and modified tests give some sense of the new behavior.

This is similar to #49 with a few differences:

  1. Text nodes have nil as tagname which will never create collisions
  2. This PR supports multiple text nodes intermixed with nested tags, like <p>Hello<br>World</p>

remysucre avatar Nov 20 '25 21:11 remysucre