use css class for styling
Do not use potentially not unique id to collapse

generated html can be added many time in one page relying on line number
to collapse is dangerous.

Walking the dom to  get next children is more reliable
some cleanup
reorganise block order, and cleanup now useless logic

special_char was use before for counting column offset, now removed.
replace by escape_html