Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/just-cameron/cameron-blog. cameron.pfiffer.org
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186<!doctype html><html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <!-- All available fonts - swap in CSS to preview --> <link href="https://fonts.googleapis.com/css2?family=Crimson+Text:wght@400;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:wght@400;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@400;600;700&display=swap" rel="stylesheet"> {{if hasmath}} {{insert head_katex.html }} {{end}} {{if hascode}} {{insert head_highlight.html }} {{end}} {{if hasmermaid}} {{insert head_mermaid.html }} {{end}} {{insert style.html}} {{isdef title}} <title>{{fill title}}</title> {{end}} </head> <body> {{ if toc }} <nav class="toc-sidebar"> <div class="toc-content" id="toc-container"> <!-- TOC will be generated by JavaScript --> </div> </nav> {{ end }} <div class="center-column-holder"> <div class="center-column"> {{insert header.html}} <!-- Content appended here --> <button id="theme-toggle" aria-label="Toggle dark mode"> 🌙 </button> </div> </div> <style> .toc-sidebar { position: fixed; right: 2rem; top: 8rem; width: 250px; max-height: calc(100vh - 10rem); overflow-y: auto; font-size: 0.9rem; z-index: 100; }
.toc-content { background: var(--bg-color, #fff); border-left: 2px solid var(--border-color, #ddd); padding-left: 1rem; }
.toc-sidebar ul { list-style: none; padding-left: 0; margin: 0; }
.toc-sidebar li { margin: 0.4rem 0; line-height: 1.4; }
.toc-sidebar ul ul { padding-left: 1rem; margin-top: 0.2rem; }
.toc-sidebar a { color: var(--text-color, #333); text-decoration: none; display: block; padding: 0.2rem 0; opacity: 0.7; transition: opacity 0.2s; }
.toc-sidebar a:hover { opacity: 1; }
/* Hide TOC on smaller screens */ @media (max-width: 1400px) { .toc-sidebar { display: none; } }
#theme-toggle { position: fixed; top: 1rem; right: 1rem; padding: 0.5rem; font-size: 1.25rem; border: none; background: none; cursor: pointer; z-index: 1000; } </style> <script> // Check for saved theme preference, otherwise use system preference const getPreferredTheme = () => { const savedTheme = localStorage.getItem("theme"); if (savedTheme) { return savedTheme; } return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; };
// Apply theme const setTheme = (theme) => { document.documentElement.setAttribute("data-theme", theme); localStorage.setItem("theme", theme); // Update button text document.getElementById("theme-toggle").innerText = theme === "dark" ? "☼" : "☾"; };
// Initialize theme setTheme(getPreferredTheme());
// Add toggle functionality document .getElementById("theme-toggle") .addEventListener("click", () => { const currentTheme = document.documentElement.getAttribute("data-theme"); setTheme(currentTheme === "dark" ? "light" : "dark"); });
// Listen for system theme changes window .matchMedia("(prefers-color-scheme: dark)") .addEventListener("change", (e) => { if (!localStorage.getItem("theme")) { setTheme(e.matches ? "dark" : "light"); } });
// Generate table of contents document.addEventListener("DOMContentLoaded", () => { const tocContainer = document.getElementById("toc-container"); if (!tocContainer) return;
const headers = document.querySelectorAll(".franklin-content h2, .franklin-content h3"); if (headers.length === 0) return;
const tocList = document.createElement("ul"); let currentH2List = null;
headers.forEach((header) => { const li = document.createElement("li"); const a = document.createElement("a"); a.href = `#${header.id}`; a.textContent = header.textContent.trim();
li.appendChild(a);
if (header.tagName === "H2") { tocList.appendChild(li); currentH2List = null; } else if (header.tagName === "H3") { if (!currentH2List) { currentH2List = document.createElement("ul"); const lastH2 = tocList.lastElementChild; if (lastH2) lastH2.appendChild(currentH2List); } currentH2List.appendChild(li); } });
tocContainer.appendChild(tocList); }); </script> </body></html>