fix link of stack overflow

This commit is contained in:
Ryan Wu 2015-04-03 19:49:14 +08:00
parent b6f44688d6
commit cb0a3af5c5
2 changed files with 3 additions and 2 deletions

3
toc.js
View file

@ -8,7 +8,8 @@
for (var i = 3; i < headers.length; i++) { //skip H1, history, and toc
var header = headers[i],
headerText = header.textContent.trim(),
hIndex = parseInt(header.nodeName.substring(1)) - 1,
headerText = headerText.replace(" ", "-");
var hIndex = parseInt(header.nodeName.substring(1)) - 1,
indent = " ".repeat(hIndex),
link = ['<pre>', indent, '* [', headerText, '](', '#', headerText, ')', '\n', '</pre>'];
result += link.join('');