site/frontend/src/Utils.js

15 lines
376 B
JavaScript
Raw Normal View History

2016-12-14 19:54:17 +00:00
// Module App.BlogEntry
function htmlDecode(input) {
var doc = new DOMParser().parseFromString(input, "text/html");
return doc.documentElement.textContent;
}
2016-12-14 19:54:17 +00:00
exports.mdify = function(id) {
var converter = new showdown.Converter()
elem = document.getElementById(id);
md = elem.innerHTML;
elem.innerHTML = htmlDecode(converter.makeHtml(md));
2016-12-14 19:54:17 +00:00
return "done :)";
}