Skip to content

Commit 243208b

Browse files
authored
Merge pull request carpentries/styles#606
Automatically add deep anchor links using AnchorJS
2 parents da77111 + 929c1a7 commit 243208b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

_includes/javascript.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<script src="{{ relative_root_path }}/assets/js/jquery.min.js"></script>
55
<script src="{{ relative_root_path }}/assets/js/bootstrap.min.js"></script>
66
<script src="{{ relative_root_path }}/assets/js/lesson.js"></script>
7+
78
<script>
89
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
910
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -12,6 +13,7 @@
1213
ga('create', 'UA-37305346-2', 'auto');
1314
ga('send', 'pageview');
1415
</script>
16+
1517
{% if page.math %}
1618
<script src="{{ relative_root_path }}/assets/js/katex.min.js"></script>
1719
<script>
@@ -28,3 +30,13 @@
2830
<script src="{{ relative_root_path }}/assets/js/katex-auto-render.min.js" onload="renderMathInElement(document.body, options)"></script>
2931
{% endif %}
3032

33+
{%- comment -%}
34+
AnchorJS: A JavaScript utility for adding deep anchor links
35+
https://github.com/bryanbraun/anchorjs
36+
https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js
37+
{%- endcomment -%}
38+
39+
<script src="{{ relative_root_path }}/assets/js/anchor.min.js"></script>
40+
<script>
41+
anchors.add();
42+
</script>

assets/js/anchor.min.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)