Skip to content

Commit

Permalink
Deploying to gh-pages from @ 3c713fb 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Sep 17, 2024
1 parent f528289 commit cb0024f
Show file tree
Hide file tree
Showing 11 changed files with 2,175 additions and 318 deletions.
Binary file added img/bandwidth_interfaces.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/memory_hierarchy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
752 changes: 463 additions & 289 deletions index.html

Large diffs are not rendered by default.

35 changes: 20 additions & 15 deletions index_files/libs/quarto-diagram/mermaid-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ if (!String.prototype.replaceAll) {

const mermaidOpts = {
startOnLoad: false,
flowchart: {
htmlLabels: "false",
},
};
// this CSS is adapted from
// mkdocs-material
Expand Down Expand Up @@ -129,12 +126,8 @@ const _quartoMermaid = {
const kFigWidth = "figWidth",
kFigHeight = "figHeight";
const options = this.resolveOptions(svgEl);
const width = svgEl.getAttribute("width");
const height = svgEl.getAttribute("height");
if (!width || !height) {
// attempt to resolve figure dimensions via viewBox
throw new Error("Internal error: couldn't find figure dimensions");
}
let width = svgEl.getAttribute("width");
let height = svgEl.getAttribute("height");
const getViewBox = () => {
const vb = svgEl.attributes.getNamedItem("viewBox").value; // do it the roundabout way so that viewBox isn't dropped by deno_dom and text/html
if (!vb) return undefined;
Expand All @@ -143,6 +136,19 @@ const _quartoMermaid = {
if (lst.some(isNaN)) return undefined;
return lst;
};
if (!width || !height) {
// attempt to resolve figure dimensions via viewBox
const viewBox = getViewBox();
if (viewBox !== undefined) {
const [_mx, _my, vbWidth, vbHeight] = viewBox;
width = `${vbWidth}px`;
height = `${vbHeight}px`;
} else {
throw new Error(
"Mermaid generated an SVG without a viewbox attribute. Without knowing the diagram dimensions, quarto cannot convert it to a PNG"
);
}
}

let svgWidthInInches, svgHeightInInches;

Expand Down Expand Up @@ -228,17 +234,16 @@ const _quartoMermaid = {
// deno-lint-ignore no-window-prefix
window.addEventListener(
"load",
function () {
async function () {
let i = 0;
// we need pre because of whitespace preservation
for (const el of Array.from(document.querySelectorAll("pre.mermaid-js"))) {
//   doesn't appear to be treated as whitespace by mermaid
// so we replace it with a space.
const text = el.innerText.replaceAll(" ", " ");
const output = mermaid.mermaidAPI.render(
const text = el.textContent.replaceAll(" ", " ");
const { svg: output } = await mermaid.mermaidAPI.render(
`mermaid-${++i}`,
text,
() => {},
el
);
el.innerHTML = output;
Expand All @@ -248,9 +253,9 @@ window.addEventListener(
const style = svg.querySelector("style");
style.innerHTML = style.innerHTML.replaceAll(
`#${svg.id}`,
`#${el.dataset.label}`
`#${el.dataset.label}-mermaid`
);
svg.id = el.dataset.label;
svg.id = el.dataset.label + "-mermaid";
delete el.dataset.label;
}

Expand Down
1,624 changes: 1,621 additions & 3 deletions index_files/libs/quarto-diagram/mermaid.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index_files/libs/quarto-html/popper.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index_files/libs/quarto-html/quarto-html.min.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/*# sourceMappingURL=0a6b880beb84f9b6f36107a76f82c5b1.css.map */

7 changes: 5 additions & 2 deletions index_files/libs/revealjs/dist/theme/quarto.css

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ window.QuartoLineHighlight = function () {
divSourceCode.forEach((el) => {
if (el.hasAttribute(kCodeLineNumbersAttr)) {
const codeLineAttr = el.getAttribute(kCodeLineNumbersAttr);
el.removeAttribute("data-code-line-numbers");
el.removeAttribute(kCodeLineNumbersAttr);
if (handleLinesSelector(deck, codeLineAttr)) {
// Only process if attr is a string to select lines to highlights
// e.g "1|3,6|8-11"
Expand Down Expand Up @@ -165,17 +165,17 @@ window.QuartoLineHighlight = function () {
if (typeof highlight.last === "number") {
spanToHighlight = [].slice.call(
codeBlock.querySelectorAll(
":scope > span:nth-child(n+" +
":scope > span:nth-of-type(n+" +
highlight.first +
"):nth-child(-n+" +
"):nth-of-type(-n+" +
highlight.last +
")"
)
);
} else if (typeof highlight.first === "number") {
spanToHighlight = [].slice.call(
codeBlock.querySelectorAll(
":scope > span:nth-child(" + highlight.first + ")"
":scope > span:nth-of-type(" + highlight.first + ")"
)
);
}
Expand Down
52 changes: 50 additions & 2 deletions index_files/libs/revealjs/plugin/quarto-support/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ window.QuartoSupport = function () {
return /print-pdf/gi.test(window.location.search);
}

// helper for theme toggling
function toggleBackgroundTheme(el, onDarkBackground, onLightBackground) {
if (onDarkBackground) {
el.classList.add('has-dark-background')
} else {
el.classList.remove('has-dark-background')
}
if (onLightBackground) {
el.classList.add('has-light-background')
} else {
el.classList.remove('has-light-background')
}
}

// implement controlsAudo
function controlsAuto(deck) {
const config = deck.getConfig();
Expand Down Expand Up @@ -111,8 +125,19 @@ window.QuartoSupport = function () {
}
}

// add footer text
function addFooter(deck) {
// tweak slide-number element
function tweakSlideNumber(deck) {
deck.on("slidechanged", function (ev) {
const revealParent = deck.getRevealElement();
const slideNumberEl = revealParent.querySelector(".slide-number");
const onDarkBackground = Reveal.getSlideBackground(ev.indexh, ev.indexv).classList.contains('has-dark-background');
const onLightBackground = Reveal.getSlideBackground(ev.indexh, ev.indexv).classList.contains('has-light-background');
toggleBackgroundTheme(slideNumberEl, onDarkBackground, onLightBackground);
})
}

// add footer text
function addFooter(deck) {
const revealParent = deck.getRevealElement();
const defaultFooterDiv = document.querySelector(".footer-default");
if (defaultFooterDiv) {
Expand All @@ -127,13 +152,17 @@ window.QuartoSupport = function () {
prevSlideFooter.remove();
}
const currentSlideFooter = ev.currentSlide.querySelector(".footer");
const onDarkBackground = Reveal.getSlideBackground(ev.indexh, ev.indexv).classList.contains('has-dark-background')
const onLightBackground = Reveal.getSlideBackground(ev.indexh, ev.indexv).classList.contains('has-light-background')
if (currentSlideFooter) {
defaultFooterDiv.style.display = "none";
const slideFooter = currentSlideFooter.cloneNode(true);
handleLinkClickEvents(deck, slideFooter);
deck.getRevealElement().appendChild(slideFooter);
toggleBackgroundTheme(slideFooter, onDarkBackground, onLightBackground)
} else {
defaultFooterDiv.style.display = "block";
toggleBackgroundTheme(defaultFooterDiv, onDarkBackground, onLightBackground)
}
});
}
Expand Down Expand Up @@ -272,6 +301,23 @@ window.QuartoSupport = function () {
}
}

function handleWhiteSpaceInColumns(deck) {
for (const outerDiv of window.document.querySelectorAll("div.columns")) {
// remove all whitespace text nodes
// whitespace nodes cause the columns to be misaligned
// since they have inline-block layout
//
// Quarto emits no whitespace nodes, but third-party tooling
// has bugs that can cause whitespace nodes to be emitted.
// See https://github.com/quarto-dev/quarto-cli/issues/8382
for (const node of outerDiv.childNodes) {
if (node.nodeType === 3 && node.nodeValue.trim() === "") {
outerDiv.removeChild(node);
}
}
}
}

return {
id: "quarto-support",
init: function (deck) {
Expand All @@ -280,11 +326,13 @@ window.QuartoSupport = function () {
fixupForPrint(deck);
applyGlobalStyles(deck);
addLogoImage(deck);
tweakSlideNumber(deck);
addFooter(deck);
addChalkboardButtons(deck);
handleTabbyClicks();
handleSlideChanges(deck);
workaroundMermaidDistance(deck);
handleWhiteSpaceInColumns(deck);
},
};
};
9 changes: 9 additions & 0 deletions index_files/libs/revealjs/plugin/reveal-chalkboard/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,15 @@ console.warn( "toggleNotesButton is deprecated, use customcontrols plugin instea
} );
a.href = window.URL.createObjectURL( blob );
} catch ( error ) {
// https://stackoverflow.com/a/6234804
// escape data for proper handling of quotes and line breaks
// in case malicious gets a chance to craft the exception message
error = String(error).replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");

a.innerHTML += ' (' + error + ')';
}
a.click();
Expand Down

0 comments on commit cb0024f

Please sign in to comment.