diff options
| author | Christine Dodrill <me@christine.website> | 2016-12-14 18:23:07 -0800 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2016-12-14 18:23:07 -0800 |
| commit | cf0cb7b7807df255e6f8ac7c92f8bd650d41e8c0 (patch) | |
| tree | 0ad278408807b39a2da79e1f41f61d0d6df61aea /frontend/src | |
| parent | fa9ad2f1c875199c55832d69cdc59166a24fb891 (diff) | |
| download | xesite-cf0cb7b7807df255e6f8ac7c92f8bd650d41e8c0.tar.xz xesite-cf0cb7b7807df255e6f8ac7c92f8bd650d41e8c0.zip | |
frontend/Utils: better unescape HTML encoded strings
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/Utils.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/frontend/src/Utils.js b/frontend/src/Utils.js index a27aa65..6068ffc 100644 --- a/frontend/src/Utils.js +++ b/frontend/src/Utils.js @@ -1,9 +1,14 @@ // Module App.BlogEntry +function htmlDecode(input) { + var doc = new DOMParser().parseFromString(input, "text/html"); + return doc.documentElement.textContent; +} + exports.mdify = function(id) { var converter = new showdown.Converter() elem = document.getElementById(id); md = elem.innerHTML; - elem.innerHTML = unescape(converter.makeHtml(md)); + elem.innerHTML = htmlDecode(converter.makeHtml(md)); return "done :)"; } |
