// strip-html-comments.ts
/**
* Strip HTML (and ESI-style) comments from a markup string prior to XML parsing.
*
* Behavior:
* - Removes all well-formed comment blocks: ``, including multiline
* content, using a non-greedy match.
* - Also removes a dangling or unterminated `/g, '');
// 2) Remove any leftover unterminated comment to end-of-input
out = out.replace(/