Skip to content

Commit 9ce0cd0

Browse files
lucperkinsk8s-ci-robot
authored andcommitted
Add AnchorJS logic for header links (#10155)
* Add AnchorJS JavaScript * Remove existing inpage_heading logic * Remove underline from anchor tags * Use single icon and add touch visibility * Use paragraph link icon for AnchorJS * Update Sass to use code formatting in docsContent headers * Update header size coverage to H3-H6
1 parent c038d89 commit 9ce0cd0

12 files changed

+23
-1978
lines changed

assets/sass/_base.sass

-7
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,6 @@ dd
800800
&:after
801801
transform: rotate(-45deg)
802802

803-
804-
805803
#docsContent
806804
position: relative
807805
float: right
@@ -895,7 +893,6 @@ dd
895893
overflow-x: auto
896894

897895
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code
898-
font-family: inherit
899896
font-size: inherit
900897
background-color: transparent
901898

@@ -999,10 +996,6 @@ dd
999996
img
1000997
max-width: 100%
1001998

1002-
a
1003-
//font-weight: 700
1004-
text-decoration: underline
1005-
1006999
#TableOfContents > ul > li { list-style: none; }
10071000
#TableOfContents
10081001
ul, li

layouts/docs/baseof.html

+1-18
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,5 @@
4848
</div>
4949
{{ partialCached "footer.html" . }}
5050
{{ partialCached "footer-scripts.html" . }}
51-
<script>
52-
// This script turns in-page headers into clickable and shareable
53-
(function addHeadingLinks(){
54-
var article = document.getElementById('docsContent');
55-
var headings = article.querySelectorAll('h1, h2, h3, h4, h5, h6');
56-
headings.forEach(function(heading){
57-
if(heading.id){
58-
var a = document.createElement('a');
59-
a.innerHTML = heading.innerHTML;
60-
a.href = '#'+heading.id;
61-
a.classList.add('inpage_heading');
62-
heading.innerHTML = '';
63-
heading.appendChild(a);
64-
}
65-
});
66-
})();
67-
</script>
6851
</body>
69-
</html>
52+
</html>

layouts/partials/head.html

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<meta property="og:image" content="{{ index . 0 | replaceRE ".*src=\"(.+?)\".*" "$1" }}" />
2828
{{ end }}
2929
{{ end }}
30+
<script src="{{ "js/anchor-4.1.1.min.js" | relURL }}"></script>
3031
<script src="{{ "js/jquery-3.2.1.min.js" | relURL }}"></script>
3132
<script src="{{ "js/jquery-ui-1.12.1.min.js" | relURL }}"></script>
3233
<script src="{{ "js/bootstrap-3.3.7.min.js" | relURL }}"></script>

resources/_gen/assets/sass/sass/case_study_styles.sass_cb957da2191fde4902dd41b139c8069d.content

+1-1
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Target":"css/styles.min.55d1e72cc5418eace24df1a4450abe45a6ee9111f9814269bc6540e8c49d2399.css","MediaType":"text/css","Data":{"Integrity":"sha256-VdHnLMVBjqziTfGkRQq+RabukRH5gUJpvGVA6MSdI5k="}}
1+
{"Target":"css/styles.min.ece7e7b8765fe37209670b4fdb98dc7c18c77ce66f423368a943e602cf2ab436.css","MediaType":"text/css","Data":{"Integrity":"sha256-7OfnuHZf43IJZwtP25jcfBjHfOZvQjNoqUPmAs8qtDY="}}

0 commit comments

Comments
 (0)