houdini

Functions

pub fn escape(string: String) -> String

Escapes a string to be safely used inside an HTML document by escaping the following characters:

  • < becomes &lt;
  • > becomes &gt;
  • & becomes &amp;
  • " becomes &quot;
  • ' becomes &#39;.

Examples

assert escape("wibble & wobble") == "wibble &amp; wobble"
assert escape("wibble > wobble") == "wibble &gt; wobble"
Search Document