Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Feb 5, 2024
1 parent 4c4cb2b commit 4343f13
Show file tree
Hide file tree
Showing 15 changed files with 470 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1ded5c31
026dc605
207 changes: 180 additions & 27 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.3.450">
<meta name="generator" content="quarto-1.4.549">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand All @@ -22,7 +22,7 @@
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
Expand Down Expand Up @@ -78,7 +78,13 @@
"collapse-after": 3,
"panel-placement": "start",
"type": "textbox",
"limit": 20,
"limit": 50,
"keyboard-shortcut": [
"f",
"/",
"s"
],
"show-item-context": false,
"language": {
"search-no-results-text": "No results",
"search-matching-documents-text": "matching documents",
Expand All @@ -87,6 +93,7 @@
"search-more-match-text": "more match in this document",
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-text-placeholder": "",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit",
"search-label": "Search"
Expand All @@ -102,7 +109,7 @@
<!-- content -->
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
<!-- sidebar -->
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
<nav id="TOC" role="doc-toc" class="toc-active">
<h2 id="toc-title">On this page</h2>

Expand All @@ -121,7 +128,7 @@ <h2 id="toc-title">On this page</h2>
</ul>
</nav>
</nav>
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
<!-- margin-sidebar -->
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
</div>
Expand All @@ -143,8 +150,10 @@ <h1 class="title">Carpentries lesson Example</h1>
</div>



</header>


<section id="questions-objectives-keypoints" class="level2">
<h2 class="anchored" data-anchor-id="questions-objectives-keypoints">Questions, objectives, keypoints</h2>
<div class="overview card">
Expand Down Expand Up @@ -193,30 +202,19 @@ <h3 class="callout-title anchored" data-anchor-id="">Keypoints</h3>
</section>
<section id="excercises-challenges" class="level2">
<h2 class="anchored" data-anchor-id="excercises-challenges">Excercises / challenges</h2>
<div id="challenge1" class="callout challenge">
<div id="discussion1" class="callout discussion">
<div class="callout-square">
<i class="callout-icon" data-feather="zap"></i>
<i class="callout-icon" data-feather="message-circle"></i>
</div>
<section id="chemistry-joke" class="level3 callout-title callout-inner">
<h3 class="callout-title anchored" data-anchor-id="chemistry-joke">Chemistry Joke</h3>
<div class="callout-content">
<p>Q: If you aren’t part of the solution, then what are you?</p>
</div>
</section>
</div>
<div id="accordionSolution1" class="accordion challenge-accordion accordion-flush">
<div class="accordion-item">
<button class="accordion-button solution-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseSolution1" aria-expanded="false" aria-controls="collapseSolution1">
<h4 class="accordion-header anchored" id="headingSolution1">
Show me the solution
</h4>
</button>
<div id="collapseSolution1" class="accordion-collapse collapse" aria-labelledby="headingSolution1" data-bs-parent="#accordionSolution1">
<div class="accordion-body">
<p>A: part of the precipitate</p>
</div>
<div class="proof solution">
<p><span class="proof-title"><em>Solution</em>. </span>A: part of the precipitate</p>
</div>
</div>
</section>
</div>
</section>
<section id="callout-blocks" class="level2">
Expand Down Expand Up @@ -257,7 +255,7 @@ <h3 class="accordion-header anchored" id="headingInstructor1">
Instructor Note
</h3>
</button>
<div id="collapseInstructor1" class="accordion-collapse collapse" aria-labelledby="headingInstructor1" data-bs-parent="#accordionInstructor1">
<div id="collapseInstructor1" class="accordion-collapse collapse" data-bs-parent="#accordionInstructor1" aria-labelledby="headingInstructor1">
<div class="accordion-body">
<p>This is an instructor note. It contains information that can be useful for instructors to know such as</p>
<ul>
Expand All @@ -270,7 +268,7 @@ <h3 class="accordion-header anchored" id="headingInstructor1">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://placekitten.com/200/200.png" class="img-fluid figure-img"></p>
<figcaption class="figure-caption">a random image of a cute kitten</figcaption>
<figcaption>Images can also appear in instructor notes</figcaption>
</figure>
</div>
</div>
Expand All @@ -288,7 +286,7 @@ <h3 class="accordion-header anchored" id="headingSpoiler1">
What Else Might We Use A Spoiler For?
</h3>
</button>
<div id="collapseSpoiler1" class="accordion-collapse collapse" aria-labelledby="headingSpoiler1" data-bs-parent="#accordionSpoiler1">
<div id="collapseSpoiler1" class="accordion-collapse collapse" data-bs-parent="#accordionSpoiler1" aria-labelledby="headingSpoiler1">
<div class="accordion-body">
<ul>
<li>including a collapsed version of a very long block of output/a large image from a code block, which the learner can expand if they want to check their output against the lesson</li>
Expand Down Expand Up @@ -444,10 +442,9 @@ <h2 class="anchored" data-anchor-id="block-quotes">Block quotes</h2>
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
Expand All @@ -457,8 +454,17 @@ <h2 class="anchored" data-anchor-id="block-quotes">Block quotes</h2>
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
placement: 'bottom-start',
};
if (contentFn) {
config.content = contentFn;
}
if (onTriggerFn) {
config.onTrigger = onTriggerFn;
}
if (onUntriggerFn) {
config.onUntrigger = onUntriggerFn;
}
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
Expand All @@ -472,6 +478,125 @@ <h2 class="anchored" data-anchor-id="block-quotes">Block quotes</h2>
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
const xrefs = window.document.querySelectorAll('a.quarto-xref');
const processXRef = (id, note) => {
// Strip column container classes
const stripColumnClz = (el) => {
el.classList.remove("page-full", "page-columns");
if (el.children) {
for (const child of el.children) {
stripColumnClz(child);
}
}
}
stripColumnClz(note)
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
container.appendChild(note.children[0].cloneNode(true));
for (let i = 1; i < note.children.length; i++) {
const child = note.children[i];
if (child.tagName === "P" && child.innerText === "") {
continue;
} else {
container.appendChild(child.cloneNode(true));
break;
}
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(container);
}
return container.innerHTML
} else {
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
return note.innerHTML;
}
} else {
// Remove any anchor links if they are present
const anchorLink = note.querySelector('a.anchorjs-link');
if (anchorLink) {
anchorLink.remove();
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
// TODO in 1.5, we should make sure this works without a callout special case
if (note.classList.contains("callout")) {
return note.outerHTML;
} else {
return note.innerHTML;
}
}
}
for (var i=0; i<xrefs.length; i++) {
const xref = xrefs[i];
tippyHover(xref, undefined, function(instance) {
instance.disable();
let url = xref.getAttribute('href');
let hash = undefined;
if (url.startsWith('#')) {
hash = url;
} else {
try { hash = new URL(url).hash; } catch {}
}
if (hash) {
const id = hash.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
if (note !== null) {
try {
const html = processXRef(id, note.cloneNode(true));
instance.setContent(html);
} finally {
instance.enable();
instance.show();
}
} else {
// See if we can fetch this
fetch(url.split('#')[0])
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.getElementById(id);
if (note !== null) {
const html = processXRef(id, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
} else {
// See if we can fetch a full url (with no hash to target)
// This is a special case and we should probably do some content thinning / targeting
fetch(url)
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.querySelector('main.content');
if (note !== null) {
// This should only happen for chapter cross references
// (since there is no id in the URL)
// remove the first header
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
note.children[0].remove();
}
const html = processXRef(null, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
}, function(instance) {
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
Expand Down Expand Up @@ -514,6 +639,7 @@ <h2 class="anchored" data-anchor-id="block-quotes">Block quotes</h2>
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
div.style.left = 0;
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
Expand All @@ -539,6 +665,32 @@ <h2 class="anchored" data-anchor-id="block-quotes">Block quotes</h2>
});
selectedAnnoteEl = undefined;
};
// Handle positioning of the toggle
window.addEventListener(
"resize",
throttle(() => {
elRect = undefined;
if (selectedAnnoteEl) {
selectCodeLines(selectedAnnoteEl);
}
}, 10)
);
function throttle(fn, ms) {
let throttle = false;
let timer;
return (...args) => {
if(!throttle) { // first call gets through
fn.apply(this, args);
throttle = true;
} else { // all the others get throttled
if(timer) clearTimeout(timer); // cancel #2
timer = setTimeout(() => {
fn.apply(this, args);
timer = throttle = false;
}, ms);
}
};
}
// Attach click handler to the DT
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
for (const annoteDlNode of annoteDls) {
Expand Down Expand Up @@ -602,4 +754,5 @@ <h2 class="anchored" data-anchor-id="block-quotes">Block quotes</h2>




</body></html>
2 changes: 1 addition & 1 deletion robots.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Sitemap: https://github.com/milanmlft/carpentries-quarto/sitemap.xml
Sitemap: https://milanmlft.github.io/carpentries-quarto/sitemap.xml
4 changes: 2 additions & 2 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"href": "example.html#excercises-challenges",
"title": "Carpentries lesson Example",
"section": "Excercises / challenges",
"text": "Excercises / challenges\n\n\n\n\n\nChemistry Joke\n\nQ: If you aren’t part of the solution, then what are you?\n\n\n\n\n\n\n \n Show me the solution\n \n\n\n\nA: part of the precipitate"
"text": "Excercises / challenges\n\n\n\n\n\nChemistry Joke\n\nQ: If you aren’t part of the solution, then what are you?\n\nSolution. A: part of the precipitate"
},
{
"objectID": "example.html#callout-blocks",
Expand All @@ -32,7 +32,7 @@
"href": "example.html#instructor-notes",
"title": "Carpentries lesson Example",
"section": "Instructor notes",
"text": "Instructor notes\n\n\n\n \n \n Instructor Note\n \n\n\n\nThis is an instructor note. It contains information that can be useful for instructors to know such as\n\nUseful hints about places that need extra attention\nsetup instructions for live coding\nreminders of what the learners should already know\nanything else\n\nYou can also include _any markdown elements_ like `code blocks`\n\n\n\na random image of a cute kitten"
"text": "Instructor notes\n\n\n\n \n \n Instructor Note\n \n\n\n\nThis is an instructor note. It contains information that can be useful for instructors to know such as\n\nUseful hints about places that need extra attention\nsetup instructions for live coding\nreminders of what the learners should already know\nanything else\n\nYou can also include _any markdown elements_ like `code blocks`\n\n\n\nImages can also appear in instructor notes"
},
{
"objectID": "example.html#spoilers",
Expand Down
Loading

0 comments on commit 4343f13

Please sign in to comment.