forked from cadey/xesite
frontend/Utils: better unescape HTML encoded strings
This commit is contained in:
parent
fa9ad2f1c8
commit
cf0cb7b780
|
@ -1,9 +1,14 @@
|
||||||
// Module App.BlogEntry
|
// Module App.BlogEntry
|
||||||
|
|
||||||
|
function htmlDecode(input) {
|
||||||
|
var doc = new DOMParser().parseFromString(input, "text/html");
|
||||||
|
return doc.documentElement.textContent;
|
||||||
|
}
|
||||||
|
|
||||||
exports.mdify = function(id) {
|
exports.mdify = function(id) {
|
||||||
var converter = new showdown.Converter()
|
var converter = new showdown.Converter()
|
||||||
elem = document.getElementById(id);
|
elem = document.getElementById(id);
|
||||||
md = elem.innerHTML;
|
md = elem.innerHTML;
|
||||||
elem.innerHTML = unescape(converter.makeHtml(md));
|
elem.innerHTML = htmlDecode(converter.makeHtml(md));
|
||||||
return "done :)";
|
return "done :)";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue