From dd241b6cc937c8883f78d56cc5cefa32ec64fd7b 2014-02-13 19:08:44
From: MinRK <benjaminrk@gmail.com>
Date: 2014-02-13 19:08:44
Subject: [PATCH] add utils.escape_html

---

diff --git a/IPython/html/static/base/js/utils.js b/IPython/html/static/base/js/utils.js
index c110ecc..6a1433c 100644
--- a/IPython/html/static/base/js/utils.js
+++ b/IPython/html/static/base/js/utils.js
@@ -460,6 +460,12 @@ IPython.utils = (function (IPython) {
     };
 
 
+    var escape_html = function (text) {
+        // escape text to HTML
+        return $("<div/>").text(text).html();
+    }
+
+
     var get_body_data = function(key) {
         // get a url-encoded item from body.data and decode it
         // we should never have any encoded URLs anywhere else in code
@@ -536,6 +542,7 @@ IPython.utils = (function (IPython) {
         url_join_encode : url_join_encode,
         encode_uri_components : encode_uri_components,
         splitext : splitext,
+        escape_html : escape_html,
         always_new : always_new,
         browser : browser,
         platform: platform,