-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Øystein Sørensen
committed
Nov 12, 2020
1 parent
35958eb
commit 8425330
Showing
52 changed files
with
614 additions
and
284 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
docs/articles/dominance_files/anchor-sections-1.0/anchor-sections.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* Styles for section anchors */ | ||
a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} | ||
a.anchor-section::before {content: '#';} | ||
.hasAnchor:hover a.anchor-section {visibility: visible;} |
33 changes: 33 additions & 0 deletions
33
docs/articles/dominance_files/anchor-sections-1.0/anchor-sections.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. | ||
document.addEventListener('DOMContentLoaded', function() { | ||
// Do nothing if AnchorJS is used | ||
if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { | ||
return; | ||
} | ||
|
||
const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | ||
|
||
// Do nothing if sections are already anchored | ||
if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { | ||
return null; | ||
} | ||
|
||
// Use section id when pandoc runs with --section-divs | ||
const section_id = function(x) { | ||
return ((x.classList.contains('section') || (x.tagName === 'SECTION')) | ||
? x.id : ''); | ||
}; | ||
|
||
// Add anchors | ||
h.forEach(function(x) { | ||
const id = x.id || section_id(x.parentElement); | ||
if (id === '') { | ||
return null; | ||
} | ||
let anchor = document.createElement('a'); | ||
anchor.href = '#' + id; | ||
anchor.classList = ['anchor-section']; | ||
x.classList.add('hasAnchor'); | ||
x.appendChild(anchor); | ||
}); | ||
}); |
Binary file modified
BIN
-37 KB
(43%)
docs/articles/dominance_files/figure-html/unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
docs/articles/dominance_files/header-attrs-2.5/header-attrs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to | ||
// be compatible with the behavior of Pandoc < 2.8). | ||
document.addEventListener('DOMContentLoaded', function(e) { | ||
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); | ||
var i, h, a; | ||
for (i = 0; i < hs.length; i++) { | ||
h = hs[i]; | ||
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 | ||
a = h.attributes; | ||
while (a.length > 0) h.removeAttribute(a[0].name); | ||
} | ||
}); |
Oops, something went wrong.