Skip to content

Commit 710940d

Browse files
doc: use AnchorJS to add visible anchor links on headings.
The standard library gets some extra attention here, to put anchor links onto each of the entries individually.
1 parent edd0625 commit 710940d

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

doc/_layouts/base.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
});
2121
</script>
2222
<script type="text/javascript" src="/third_party/MathJax-2.7.2/MathJax.js"></script>
23+
<script type="text/javascript" src="/third_party/anchor.min.js"></script>
2324

2425

2526
<!-- Google Analytics -->
@@ -134,6 +135,14 @@
134135
</div>
135136
</div>
136137

138+
<script>
139+
anchors.options = {
140+
placement: 'right',
141+
visible: 'always',
142+
icon: '#'
143+
};
144+
anchors.add('h2,h3');
145+
</script>
137146
</body>
138147

139148
</html>

doc/_layouts/stdlib.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
layout: base
3+
viewport_width: 576
4+
---
5+
{{ content }}
6+
7+
<script>
8+
(function(){
9+
let funcAnchors = new AnchorJS({
10+
placement: 'left',
11+
});
12+
funcAnchors.add('h4');
13+
})(window);
14+
</script>

doc/_stdlib_gen/stdlib.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ local stdlibPage = [
8484
];
8585

8686
local stdlibFrontMatter = {
87-
layout: 'default',
87+
layout: 'stdlib',
8888
title: 'Standard Library',
8989
};
9090

doc/ref/stdlib.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# AUTOGENERATED FILE. DO NOT EDIT BY HAND!
3-
layout: default
3+
layout: stdlib
44
title: Standard Library
55
---
66

0 commit comments

Comments
 (0)