Skip to content

Commit

Permalink
Add AnchorJS logic for header links (#10155)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lucperkins authored and k8s-ci-robot committed Sep 10, 2018
1 parent c038d89 commit 9ce0cd0
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 1,978 deletions.
7 changes: 0 additions & 7 deletions assets/sass/_base.sass
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,6 @@ dd
&:after
transform: rotate(-45deg)



#docsContent
position: relative
float: right
Expand Down Expand Up @@ -895,7 +893,6 @@ dd
overflow-x: auto

h1 code, h2 code, h3 code, h4 code, h5 code, h6 code
font-family: inherit
font-size: inherit
background-color: transparent

Expand Down Expand Up @@ -999,10 +996,6 @@ dd
img
max-width: 100%

a
//font-weight: 700
text-decoration: underline

#TableOfContents > ul > li { list-style: none; }
#TableOfContents
ul, li
Expand Down
19 changes: 1 addition & 18 deletions layouts/docs/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,5 @@
</div>
{{ partialCached "footer.html" . }}
{{ partialCached "footer-scripts.html" . }}
<script>
// This script turns in-page headers into clickable and shareable
(function addHeadingLinks(){
var article = document.getElementById('docsContent');
var headings = article.querySelectorAll('h1, h2, h3, h4, h5, h6');
headings.forEach(function(heading){
if(heading.id){
var a = document.createElement('a');
a.innerHTML = heading.innerHTML;
a.href = '#'+heading.id;
a.classList.add('inpage_heading');
heading.innerHTML = '';
heading.appendChild(a);
}
});
})();
</script>
</body>
</html>
</html>
1 change: 1 addition & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<meta property="og:image" content="{{ index . 0 | replaceRE ".*src=\"(.+?)\".*" "$1" }}" />
{{ end }}
{{ end }}
<script src="{{ "js/anchor-4.1.1.min.js" | relURL }}"></script>
<script src="{{ "js/jquery-3.2.1.min.js" | relURL }}"></script>
<script src="{{ "js/jquery-ui-1.12.1.min.js" | relURL }}"></script>
<script src="{{ "js/bootstrap-3.3.7.min.js" | relURL }}"></script>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Target":"css/styles.min.55d1e72cc5418eace24df1a4450abe45a6ee9111f9814269bc6540e8c49d2399.css","MediaType":"text/css","Data":{"Integrity":"sha256-VdHnLMVBjqziTfGkRQq+RabukRH5gUJpvGVA6MSdI5k="}}
{"Target":"css/styles.min.ece7e7b8765fe37209670b4fdb98dc7c18c77ce66f423368a943e602cf2ab436.css","MediaType":"text/css","Data":{"Integrity":"sha256-7OfnuHZf43IJZwtP25jcfBjHfOZvQjNoqUPmAs8qtDY="}}
Loading

0 comments on commit 9ce0cd0

Please sign in to comment.