frontend/Utils: better unescape HTML encoded strings
This commit is contained in:
parent
fa9ad2f1c8
commit
cf0cb7b780
|
@ -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 :)";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue