repairHtml(html) Last updated: 16. Apr 2026

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

Name Type Description
html string 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

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#docly.repairHtml("<p class=test>h<b>ei")#

Output

The #JS code above produces the output shown below:
<p class="test">h<b>ei</b></p>