From 56d985cb8376bf1d654c0ad80be22b155dfc2159 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Fri, 21 Jun 2019 12:29:26 +0200 Subject: [PATCH] Fix markdown link in title issue --- www/common/diffMarked.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/www/common/diffMarked.js b/www/common/diffMarked.js index 926be24b8..ff522ead6 100644 --- a/www/common/diffMarked.js +++ b/www/common/diffMarked.js @@ -45,6 +45,7 @@ define([ var toc = []; var getTOC = function () { + console.log(toc); var content = [h('h2', Messages.markdown_toc)]; toc.forEach(function (obj) { // Only include level 2 headings @@ -84,7 +85,14 @@ define([ } }; + var stripTags = function (text) { + var div = document.createElement("div"); + div.innerHTML = text; + return div.innerText; + } + renderer.heading = function (text, level) { + console.log(text, level); var i = 0; var safeText = text.toLowerCase().replace(/[^\w]+/g, '-'); var getId = function () { @@ -99,7 +107,7 @@ define([ toc.push({ level: level, id: id, - title: text + title: stripTags(text) }); return "" + text + ""; }; @@ -122,10 +130,10 @@ define([ } if (!isCheckedTaskItem && !isUncheckedTaskItem && hasBogusInput) { if (/checked/.test(text)) { - text = text.replace(bogusCheckPtn, + text = text.replace(bogusCheckPtn, '') + '\n'; } else if (/disabled/.test(text)) { - text = text.replace(bogusCheckPtn, + text = text.replace(bogusCheckPtn, '') + '\n'; } }