Move stripTags function to Util

This commit is contained in:
ClemDee
2019-07-24 14:41:37 +02:00
parent 0636714829
commit 6ae5da3d10
2 changed files with 7 additions and 7 deletions

View File

@@ -84,12 +84,6 @@ define([
}
};
var stripTags = function (text) {
var div = document.createElement("div");
div.innerHTML = text;
return div.innerText;
};
renderer.heading = function (text, level) {
var i = 0;
var safeText = text.toLowerCase().replace(/[^\w]+/g, '-');
@@ -105,7 +99,7 @@ define([
toc.push({
level: level,
id: id,
title: stripTags(text)
title: Util.stripTags(text)
});
return "<h" + level + " id=\"" + id + "\"><a href=\"#" + id + "\" class=\"anchor\"></a>" + text + "</h" + level + ">";
};