feat(docs): add dark-mode HTML styling and drop per-page ToC
- Add docs/html-style.html with Catppuccin Latte/Mocha palette, auto-selected via prefers-color-scheme - Update html-docs workflow: embed stylesheet via --include-in-header, remove --toc so per-page sidebar is gone (index.html remains the ToC) - Touch docs/fish-config.md to trigger the HTML generation workflow fix(ci): clear docs/html/ before pandoc to avoid directory-exists error fix(docs): restore toc on index, hide it on section pages via JS, fix full-page bg fix(docs): fix nav alignment by grouping label+link pairs as flex units chore(docs): regenerate offline HTML docs
This commit is contained in:
@@ -0,0 +1,301 @@
|
||||
<style>
|
||||
/* ── Catppuccin Latte (light) / Mocha (dark) ─────────────────── */
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
--bg: #eff1f5;
|
||||
--surface: #e6e9ef;
|
||||
--overlay: #ccd0da;
|
||||
--text: #4c4f69;
|
||||
--sub1: #6c6f85;
|
||||
--sub0: #8c8fa1;
|
||||
--blue: #1e66f5;
|
||||
--lavender: #7287fd;
|
||||
--sapphire: #209fb5;
|
||||
--green: #40a02b;
|
||||
--yellow: #df8e1d;
|
||||
--peach: #fe640b;
|
||||
--mauve: #8839ef;
|
||||
--code-bg: #dce0e8;
|
||||
--border: #bcc0cc;
|
||||
--glow1: rgba(30, 102, 245, 0.05);
|
||||
--glow2: rgba(136, 57, 239, 0.04);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: #1e1e2e;
|
||||
--surface: #313244;
|
||||
--overlay: #45475a;
|
||||
--text: #cdd6f4;
|
||||
--sub1: #bac2de;
|
||||
--sub0: #a6adc8;
|
||||
--blue: #89b4fa;
|
||||
--lavender: #b4befe;
|
||||
--sapphire: #74c7ec;
|
||||
--green: #a6e3a1;
|
||||
--yellow: #f9e2af;
|
||||
--peach: #fab387;
|
||||
--mauve: #cba6f7;
|
||||
--code-bg: #181825;
|
||||
--border: #45475a;
|
||||
--glow1: rgba(137, 180, 250, 0.06);
|
||||
--glow2: rgba(203, 166, 247, 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
|
||||
html {
|
||||
background-color: var(--bg);
|
||||
background-image:
|
||||
radial-gradient(ellipse 55% 40% at 10% 5%, var(--glow1) 0%, transparent 100%),
|
||||
radial-gradient(ellipse 45% 45% at 90% 95%, var(--glow2) 0%, transparent 100%);
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
color: var(--text);
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Helvetica, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.75;
|
||||
max-width: 880px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem 2.5rem 5rem;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* ── Links ─────────────────────────────────────────────────── */
|
||||
a { color: var(--blue); text-decoration: none; }
|
||||
a:hover { color: var(--lavender); text-decoration: underline; }
|
||||
a:visited { color: var(--lavender); }
|
||||
|
||||
/* ── Headings ──────────────────────────────────────────────── */
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
|
||||
color: var(--lavender);
|
||||
line-height: 1.3;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
h1 {
|
||||
font-size: 1.9rem;
|
||||
color: var(--text);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding-bottom: 0.4em;
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1.35rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding-bottom: 0.2em;
|
||||
}
|
||||
h3 { font-size: 1.1rem; color: var(--sapphire); }
|
||||
h4 { font-size: 0.95rem; color: var(--sub1); }
|
||||
|
||||
p { margin: 0.8em 0; }
|
||||
|
||||
/* ── Title block (pandoc-generated cover) ──────────────────── */
|
||||
#title-block-header {
|
||||
text-align: center;
|
||||
padding: 2.5rem 0 2rem;
|
||||
margin-bottom: 1.5rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
#title-block-header .title {
|
||||
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
|
||||
font-size: 2.6rem;
|
||||
letter-spacing: 0.12em;
|
||||
color: var(--lavender);
|
||||
border: none;
|
||||
margin: 0 0 0.75rem;
|
||||
}
|
||||
#title-block-header .author,
|
||||
#title-block-header .date {
|
||||
color: var(--sub0);
|
||||
font-size: 0.875rem;
|
||||
margin: 0.2rem 0;
|
||||
}
|
||||
|
||||
/* ── Inline code ───────────────────────────────────────────── */
|
||||
code {
|
||||
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
|
||||
background: var(--code-bg);
|
||||
color: var(--peach);
|
||||
padding: 0.15em 0.4em;
|
||||
border-radius: 4px;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
/* ── Code blocks ───────────────────────────────────────────── */
|
||||
pre {
|
||||
background: var(--code-bg);
|
||||
border: 1px solid var(--border);
|
||||
border-left: 3px solid var(--sapphire);
|
||||
border-radius: 0 8px 8px 0;
|
||||
padding: 1.1em 1.4em;
|
||||
overflow-x: auto;
|
||||
line-height: 1.55;
|
||||
margin: 1.2em 0;
|
||||
}
|
||||
pre code {
|
||||
background: none;
|
||||
color: var(--text);
|
||||
padding: 0;
|
||||
font-size: 0.88em;
|
||||
}
|
||||
|
||||
/* ── Blockquotes ───────────────────────────────────────────── */
|
||||
blockquote {
|
||||
border-left: 3px solid var(--yellow);
|
||||
margin: 1.5em 0;
|
||||
padding: 0.75em 1.25em;
|
||||
background: var(--surface);
|
||||
color: var(--sub1);
|
||||
border-radius: 0 6px 6px 0;
|
||||
}
|
||||
blockquote p { margin: 0.3em 0; }
|
||||
|
||||
/* ── Tables ────────────────────────────────────────────────── */
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin: 1.4em 0;
|
||||
font-size: 0.93em;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid var(--border);
|
||||
padding: 0.55em 0.9em;
|
||||
text-align: left;
|
||||
}
|
||||
th {
|
||||
background: var(--surface);
|
||||
color: var(--lavender);
|
||||
font-weight: 600;
|
||||
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
|
||||
font-size: 0.82em;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
tr:nth-child(even) { background: var(--surface); }
|
||||
tr:hover { background: var(--overlay); }
|
||||
|
||||
/* ── HR ────────────────────────────────────────────────────── */
|
||||
hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }
|
||||
|
||||
/* ── Lists ─────────────────────────────────────────────────── */
|
||||
ul, ol { padding-left: 1.6em; }
|
||||
li { margin: 0.35em 0; }
|
||||
|
||||
/* ── Chunk navigation bar (prev / up / next) ───────────────── */
|
||||
nav:not(#TOC):not([role="doc-toc"]) {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
margin: 1.5em 0;
|
||||
font-size: 0.875em;
|
||||
overflow: hidden;
|
||||
}
|
||||
nav:not(#TOC):not([role="doc-toc"]) p {
|
||||
margin: 0;
|
||||
padding: 0.65em 1.2em;
|
||||
display: flex;
|
||||
gap: 0.4em 1.75em;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
/* JS wraps each "Label: <a>" pair in .nav-item so they flex as a unit */
|
||||
.nav-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.nav-item a { color: var(--blue); }
|
||||
.nav-item a:hover { color: var(--lavender); }
|
||||
|
||||
/* ── Table of contents panel ───────────────────────────────── */
|
||||
nav#TOC, nav[role="doc-toc"] {
|
||||
display: block;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-left: 3px solid var(--lavender);
|
||||
border-radius: 0 8px 8px 0;
|
||||
padding: 1.2em 1.5em;
|
||||
margin: 1.5em 0;
|
||||
}
|
||||
nav#TOC > h2,
|
||||
nav[role="doc-toc"] > h2 {
|
||||
font-size: 0.7rem;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
color: var(--sub0);
|
||||
border: none;
|
||||
margin: 0 0 0.9em;
|
||||
padding: 0;
|
||||
}
|
||||
nav#TOC ul, nav[role="doc-toc"] ul {
|
||||
list-style: none;
|
||||
padding-left: 1em;
|
||||
margin: 0.25em 0;
|
||||
}
|
||||
nav#TOC > ul, nav[role="doc-toc"] > ul { padding-left: 0; }
|
||||
nav#TOC li, nav[role="doc-toc"] li {
|
||||
margin: 0.3em 0;
|
||||
padding-left: 0.75em;
|
||||
border-left: 1px solid transparent;
|
||||
transition: border-color 0.12s;
|
||||
}
|
||||
nav#TOC li:hover, nav[role="doc-toc"] li:hover {
|
||||
border-left-color: var(--lavender);
|
||||
}
|
||||
nav#TOC a, nav[role="doc-toc"] a {
|
||||
color: var(--sub1);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
nav#TOC a:hover, nav[role="doc-toc"] a:hover {
|
||||
color: var(--lavender);
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
/* ── Hide ToC on every page except index.html ───────────── */
|
||||
var path = location.pathname;
|
||||
var onIndex = path === '/' || path === '' || /\/index\.html(\?.*)?$/.test(path);
|
||||
if (!onIndex) {
|
||||
var toc = document.getElementById('TOC') ||
|
||||
document.querySelector('[role="doc-toc"]');
|
||||
if (toc) toc.remove();
|
||||
}
|
||||
|
||||
/* ── Wrap each "Label: <a>" pair in a .nav-item span ───────
|
||||
Pandoc emits label text nodes and anchors as siblings;
|
||||
flex sees them as separate items, causing labels to split
|
||||
from their links when wrapping. Grouping them in a span
|
||||
keeps each label+link as a single flex unit. */
|
||||
document.querySelectorAll('nav:not(#TOC):not([role="doc-toc"])').forEach(function (nav) {
|
||||
var p = nav.querySelector('p');
|
||||
if (!p) return;
|
||||
var children = Array.from(p.childNodes);
|
||||
var pairs = [];
|
||||
for (var i = 0; i + 1 < children.length; i++) {
|
||||
var cur = children[i];
|
||||
var nxt = children[i + 1];
|
||||
if (cur.nodeType === Node.TEXT_NODE &&
|
||||
/[A-Z][a-z]*:\s*/.test(cur.textContent) &&
|
||||
nxt.nodeType === Node.ELEMENT_NODE &&
|
||||
nxt.tagName === 'A') {
|
||||
pairs.push([cur, nxt]);
|
||||
i++; // skip the anchor on the next iteration
|
||||
}
|
||||
}
|
||||
pairs.forEach(function (pair) {
|
||||
var span = document.createElement('span');
|
||||
span.className = 'nav-item';
|
||||
p.insertBefore(span, pair[0]);
|
||||
span.appendChild(pair[0]);
|
||||
span.appendChild(pair[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user