num-html type detect/sorting works with multiline

Improved num-html sorting and type-detection to handle html tags that
span multiple lines.