5 Star 15 Fork 3

妙正灰. / How-To-Ask-Questions-The-Smart-Way

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
toc.js 768 Bytes
一键复制 编辑 原始数据 按行查看 历史
Ryan Wu 提交于 2015-04-03 20:02 . remove symbol in anchorText
(function(window) {
String.prototype.repeat = function(num) {
return new Array(num + 1).join(this);
};
var url = document.URL,
headers = jQuery("article :header"),
result;
for (var i = 3; i < headers.length; i++) { //skip H1, history, and toc
var header = headers[i],
headerText = header.textContent.trim();
var anchorText = headerText.toLowerCase();
anchorText = anchorText.replace(" ", "-");
anchorText = anchorText.replace(/,|:|、/g, "");
var hIndex = parseInt(header.nodeName.substring(1)) - 1,
indent = " ".repeat(hIndex),
link = ['<pre>', indent, '* [', headerText, '](', '#', anchorText, ')', '\n', '</pre>'];
result += link.join('');
}
var win = window.open("", "win");
win.document.body.innerHTML = result;
})(window);
1
https://gitee.com/mifar/How-To-Ask-Questions-The-Smart-Way.git
git@gitee.com:mifar/How-To-Ask-Questions-The-Smart-Way.git
mifar
How-To-Ask-Questions-The-Smart-Way
How-To-Ask-Questions-The-Smart-Way
master

搜索帮助