Clean code

pull/1/head
ClemDee 5 years ago
parent a204740ac2
commit 5679dd9fee

@ -63,8 +63,6 @@ define([
}; };
DiffMd.render = function (md, sanitize, restrictedMd) { DiffMd.render = function (md, sanitize, restrictedMd) {
console.error("DIFFMD RENDER", restrictedMd);
console.log("md:\n", md);
Marked.setOptions({ Marked.setOptions({
renderer: restrictedMd ? restrictedRenderer : renderer, renderer: restrictedMd ? restrictedRenderer : renderer,
}); });
@ -183,14 +181,17 @@ define([
}; };
restrictedRenderer.image = renderer.image; restrictedRenderer.image = renderer.image;
var renderParagraph = function (p) {
return /<media\-tag[\s\S]*>/i.test(p)? p + '\n': '<p>' + p + '</p>\n';
};
renderer.paragraph = function (p) { renderer.paragraph = function (p) {
if (p === '[TOC]') { if (p === '[TOC]') {
return '<p><div class="cp-md-toc"></div></p>'; return '<p><div class="cp-md-toc"></div></p>';
} }
return /<media\-tag[\s\S]*>/i.test(p)? p + '\n': '<p>' + p + '</p>\n'; return renderParagraph(p);
}; };
restrictedRenderer.paragraph = function (p) { restrictedRenderer.paragraph = function (p) {
return /<media\-tag[\s\S]*>/i.test(p)? p + '\n': '<p>' + p + '</p>\n'; return renderParagraph(p);
}; };
var MutationObserver = window.MutationObserver; var MutationObserver = window.MutationObserver;

Loading…
Cancel
Save