Docly Developers
Function Updated 20 May 2026

repairHtml(html)

Parses and repairs an HTML string by adding missing end tags, closing quotes, and fixing malformed markup. Returns a valid, well-formed HTML string.

Parameters

htmlstringrequired

The HTML string to be parsed and repaired.

Returns

A well-formed HTML string with missing end tags added, unclosed quotes fixed, and other markup errors repaired.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#docly.repairHtml("<p class=test>h<b>ei")#