Move stripTags function to Util
This commit is contained in:
parent
0636714829
commit
6ae5da3d10
@ -319,6 +319,12 @@ define([], function () {
|
|||||||
return window.innerHeight < 800 || window.innerWidth < 800;
|
return window.innerHeight < 800 || window.innerWidth < 800;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Util.stripTags = function (text) {
|
||||||
|
var div = document.createElement("div");
|
||||||
|
div.innerHTML = text;
|
||||||
|
return div.innerText;
|
||||||
|
};
|
||||||
|
|
||||||
return Util;
|
return Util;
|
||||||
});
|
});
|
||||||
}(self));
|
}(self));
|
||||||
|
|||||||
@ -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) {
|
renderer.heading = function (text, level) {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var safeText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
var safeText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
||||||
@ -105,7 +99,7 @@ define([
|
|||||||
toc.push({
|
toc.push({
|
||||||
level: level,
|
level: level,
|
||||||
id: id,
|
id: id,
|
||||||
title: stripTags(text)
|
title: Util.stripTags(text)
|
||||||
});
|
});
|
||||||
return "<h" + level + " id=\"" + id + "\"><a href=\"#" + id + "\" class=\"anchor\"></a>" + text + "</h" + level + ">";
|
return "<h" + level + " id=\"" + id + "\"><a href=\"#" + id + "\" class=\"anchor\"></a>" + text + "</h" + level + ">";
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user