Skip to content

Commit 57b59c7

Browse files
committed
compiling book
1 parent 6573387 commit 57b59c7

File tree

7 files changed

+589
-0
lines changed

7 files changed

+589
-0
lines changed
Loading
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* Styles for section anchors */
2+
a.anchor-section::before {content: '#';font-size: 80%;}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* Styles for section anchors */
2+
a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;}
3+
.hasAnchor:hover a.anchor-section {visibility: visible;}
4+
ul > li > .anchor-section {display: none;}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
document.addEventListener('DOMContentLoaded', function () {
2+
// If section divs is used, we need to put the anchor in the child header
3+
const headers = document.querySelectorAll("div.hasAnchor.section[class*='level'] > :first-child")
4+
5+
headers.forEach(function (x) {
6+
// Add to the header node
7+
if (!x.classList.contains('hasAnchor')) x.classList.add('hasAnchor')
8+
// Remove from the section or div created by Pandoc
9+
x.parentElement.classList.remove('hasAnchor')
10+
})
11+
})
Loading

0 commit comments

Comments
 (0)