Skip to content

Function: cleanOfficeHTML() ​

ts
function cleanOfficeHTML(html, doc?): string;

Rewrite HTML pasted from Microsoft Word so it parses well: Word writes lists as paragraphs styled mso-list with a typed-out marker, not as <ul>/<ol>. Those become real, nested lists; Word-only markup (<o:p>, conditional comments, marker spans) is removed. Other HTML is returned unchanged. Needs a DOM (it runs in the browser, on paste).

Parameters ​

ParameterTypeDefault value
htmlstringundefined
doc?Documentdocument

Returns ​

string