facilmap/frontend/app/marked/marked.js

24 wiersze
608 B
JavaScript
Czysty Zwykły widok Historia

(function(fp, $, ng, undefined) {
fp.app.factory("fpMarked", function() {
2014-12-31 15:17:57 +00:00
marked.setOptions({
breaks: true,
sanitize: true
});
return {
block: function(string, options) {
var ret = $("<div/>").html(marked(string, options));
$("a[href]", ret).attr("target", "_blank");
return ret.html();
},
2014-12-31 15:17:57 +00:00
inline: function(string, options) {
var ret = $("<div/>").html(marked(string, options));
$("p", ret).replaceWith(function() { return $(this).contents(); });
$("a[href]", ret).attr("target", "_blank");
2014-12-31 15:17:57 +00:00
return ret.html();
}
};
});
})(FacilPad, jQuery, angular);