Files
retro3d/website/index.html
2025-12-17 03:36:29 -06:00

158 lines
3.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Manual</title>
<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>
<link href="https://fonts.googleapis.com/css2?family=Doto:wght@100..900&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #fff;
--text-color: #333;
--border-color: #ddd;
--code-bg: #f4f4f4;
}
@media (prefers-color-scheme: dark) {
:root {
--bg-color: #000;
--text-color: #fff;
--border-color: #444;
--code-bg: #222;
}
}
body {
margin: 0;
display: flex;
font-family: "Doto", sans-serif;
font-style: normal;
font-weight: 700;
background-color: var(--bg-color);
color: var(--text-color);
}
code {
font-family: "Doto", monospace;
font-weight: 900;
font-size: 0.8em;
}
nav {
width: 280px;
padding: 1rem;
border-right: 1px solid var(--border-color);
overflow-y: auto;
font-size: 0.9rem;
position: sticky;
top: 0;
height: 100vh;
flex-shrink: 0;
}
nav a {
display: block;
color: var(--text-color);
text-decoration: none;
margin: 0.25rem 0;
}
nav a:hover {
text-decoration: underline;
}
main {
max-width: 900px;
padding: 2rem;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
}
code {
background: var(--code-bg);
padding: 0.2em 0.4em;
border-radius: 3px;
}
pre code {
display: block;
padding: 1rem;
overflow-x: auto;
}
</style>
</head>
<body>
<!-- Sidebar (empty without JS) -->
<nav id="toc"></nav>
<!-- Fallback: raw markdown is readable without JS -->
<main>
<pre id="fallback">
Loading manual…
If JavaScript is disabled, the Markdown below is the documentation.
</pre>
</main>
<noscript>
<style>
nav { display: none; }
</style>
</noscript>
<!-- Progressive enhancement -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
// Configure marked to handle line breaks
marked.setOptions({
breaks: true, // Convert \n to <br>
gfm: true // GitHub Flavored Markdown
});
fetch("manual.md")
.then(r => r.text())
.then(md => {
// Replace fallback with rendered HTML
const main = document.querySelector("main");
main.innerHTML = marked.parse(md);
// Build TOC
const toc = document.getElementById("toc");
const headers = main.querySelectorAll("h1, h2, h3");
headers.forEach(h => {
if (!h.id) {
h.id = h.textContent
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-|-$/g, "");
}
const a = document.createElement("a");
a.href = "#" + h.id;
a.textContent = h.textContent;
a.style.marginLeft =
h.tagName === "H2" ? "1rem" :
h.tagName === "H3" ? "2rem" : "0";
toc.appendChild(a);
});
})
.catch(err => {
document.getElementById("fallback").textContent =
"Failed to load manual.md\n\n" + err;
});
</script>
</body>
</html>