Skip to content

Commit 20a7e55

Browse files
committed
Toc test
1 parent 25f93e0 commit 20a7e55

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

web/script.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function parseMd() {
1212
aDiv.after(nodes);
1313
insertLinks()
1414
d3.selectAll("code").each(function() { hljs.highlightBlock(this); });
15+
addToc()
1516
});
1617
}
1718

@@ -21,3 +22,11 @@ function insertLinks() {
2122
$(this).append('<a href="#'+aId+'" name="'+aId+'">#</a>')
2223
})
2324
}
25+
26+
function addToc() {
27+
headerMain = $('#main')
28+
nodes = $.parseHTML(TOC)
29+
headerMain.before(nodes)
30+
}
31+
32+
var TOC = '<h2 id="toc">Contents<a href="#toc" name="toc">#</a></h2>'

0 commit comments

Comments
 (0)