frontend/Utils: better unescape HTML encoded strings

This commit is contained in:
Cadey Ratio 2016-12-14 18:23:07 -08:00
parent fa9ad2f1c8
commit cf0cb7b780
1 changed files with 6 additions and 1 deletions

View File

@ -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 :)";
}