Clean paste

The editor

Clean paste

Paste from Word, Google Docs or the web and get clean, on-brand content, not a mess of inline styles.

When a user pastes, the editor sanitizes the HTML: scripts, styles, classes and Office cruft are stripped, only a safe allowlist of formatting tags survives, and links keep just theirhref.

See also text editing.

What the editor does on paste

In the rich text editor, HTML from Word, Outlook or Google Docs is recognised by its markup (mso- styles, Mso classes, <o:p> tags, Google's docs-internal-guid) and cleaned:

  • Word's typed bullets and numbers become real <ul> and <ol> lists, nested up to four levels.
  • Classes, ids, lang and dir are removed. Of the inline styles, only a non-black color, bold, italic and underline are kept, so the document's fonts and point sizes do not come along.
  • The empty paragraphs Word uses for spacing are dropped.

HTML from other sources is pasted as it is, within what the text editor supports. Plain text keeps its lines: each line becomes a paragraph and an empty line stays empty.