instance method String#escapeHTML

View source on GitHub →

String#escapeHTML() → String

Converts HTML special characters to their entity equivalents.

Example
'<div class="article">This is an article</div>'.escapeHTML();
// -> "&lt;div class="article"&gt;This is an article&lt;/div&gt;"