-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.html
49 lines (42 loc) · 1.2 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<meta charset="utf-8">
<style>
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
h1,h2,h3 {
margin-bottom: 200px;
}
</style>
<script src="build/build.js"></script>
<link rel="stylesheet" type="text/css" href="build/build.css" media="screen" charset="utf-8">
</head>
<body>
<h1>Title 1</h1>
<h1 id="title_1-1">Title 1</h1>
<h1>Title 1</h1>
<h2 id="defined-slug_ola">Title 1.1 olà</h2>
<h3>Title 1.1.1</h3>
<div id="context">
<h2>Title 1.2</h2>
<h1 id="2">Title 2</h1>
<h3 id="2x1">Title 2.x.1</h3>
<h4>Title 2.x.1.1</h4>
</div>
<script type="text/javascript">
var Toc = require('toc');
var toc = new Toc();
// example with new default context and new default selector
//var toc = new Toc('#context', 'h1[id],h2[id]');
toc.el.prepend('<li><a href="http://component.io/nrako/toc">toc - component.io</a></li>');
toc.el.appendTo('body');
// example rebuild toc with custom context and custom selector
//toc.parse('#context', 'h1,h2,h3');
//toc.build();
console.log(toc.tree);
</script>
</body>
</html>