Spaces:
Paused

miracle / templates /docs.html
dushyantsingh0
backend stabilization
829f259
Raw History Blame Contribute Delete
9.07 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }} | Nexus Docs</title>
<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=Inter:wght@400;500;600;700&family=Outfit:wght@700;800&family=Fira+Code:wght@400;500&display=swap" rel="stylesheet">
<style>
:root {
--primary: #7C3AED;
--primary-light: #F5F3FF;
--text-main: #0f172a;
--text-muted: #64748b;
--bg-page: #ffffff;
--bg-sidebar: #f8fafc;
--border: #e2e8f0;
--code-bg: #f1f5f9;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background-color: var(--bg-page);
color: var(--text-main);
font-family: 'Inter', sans-serif;
line-height: 1.6;
display: flex;
min-height: 100vh;
}
/* --- SIDEBAR --- */
.sidebar {
width: 300px;
background: var(--bg-sidebar);
border-right: 1px solid var(--border);
padding: 40px 24px;
position: sticky;
top: 0;
height: 100vh;
overflow-y: auto;
}
.logo {
font-family: 'Outfit', sans-serif;
font-size: 20px;
font-weight: 800;
color: var(--primary);
text-decoration: none;
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 40px;
}
.nav-group {
margin-bottom: 32px;
}
.nav-label {
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
margin-bottom: 12px;
display: block;
}
.nav-item {
display: block;
padding: 8px 12px;
border-radius: 8px;
text-decoration: none;
color: var(--text-main);
font-size: 14px;
font-weight: 500;
margin-bottom: 4px;
transition: all 0.2s;
}
.nav-item:hover {
background: var(--primary-light);
color: var(--primary);
}
.nav-item.active {
background: var(--primary);
color: white;
}
/* --- CONTENT --- */
main {
flex: 1;
padding: 60px 80px;
max-width: 900px;
}
.markdown-body h1 {
font-family: 'Outfit', sans-serif;
font-size: 42px;
font-weight: 800;
margin-bottom: 24px;
letter-spacing: -1px;
}
.markdown-body h2 {
font-family: 'Outfit', sans-serif;
font-size: 28px;
font-weight: 700;
margin-top: 48px;
margin-bottom: 16px;
border-bottom: 1px solid var(--border);
padding-bottom: 8px;
}
.markdown-body h3 {
font-size: 20px;
font-weight: 700;
margin-top: 32px;
margin-bottom: 12px;
}
.markdown-body p {
margin-bottom: 16px;
color: #334155;
}
.markdown-body code {
font-family: 'Fira Code', monospace;
background: var(--code-bg);
padding: 2px 6px;
border-radius: 4px;
font-size: 0.9em;
}
.markdown-body pre {
background: #1e293b;
color: #f8fafc;
padding: 24px;
border-radius: 12px;
overflow-x: auto;
margin: 24px 0;
font-family: 'Fira Code', monospace;
font-size: 14px;
line-height: 1.5;
}
.markdown-body pre code {
background: transparent;
padding: 0;
color: inherit;
}
.markdown-body ul, .markdown-body ol {
margin-bottom: 16px;
padding-left: 24px;
}
.markdown-body li {
margin-bottom: 8px;
}
.markdown-body img {
max-width: 100%;
border-radius: 12px;
border: 1px solid var(--border);
margin: 24px 0;
}
.markdown-body blockquote {
border-left: 4px solid var(--primary);
padding: 16px 24px;
background: var(--primary-light);
border-radius: 0 12px 12px 0;
margin: 24px 0;
color: var(--text-main);
}
/* Mermaid Styling */
.mermaid {
background: #f8fafc;
padding: 20px;
border-radius: 12px;
border: 1px solid var(--border);
margin: 24px 0;
display: flex;
justify-content: center;
}
/* Syntax Highlighting overrides if needed */
.codehilite .k { color: #f472b6; } /* keyword */
.codehilite .s { color: #34d399; } /* string */
.codehilite .nf { color: #60a5fa; } /* function */
.codehilite .c1 { color: #94a3b8; } /* comment */
@media (max-width: 1024px) {
main { padding: 40px; }
}
@media (max-width: 768px) {
body { flex-direction: column; }
.sidebar { width: 100%; height: auto; position: relative; }
main { padding: 32px 24px; }
}
</style>
</head>
<body>
<aside class="sidebar">
<a href="/" class="logo">
<div style="width: 28px; height: 28px; background: var(--primary); color: white; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900;">N</div>
NEXUS <span style="color: var(--text-muted); font-weight: 500; font-size: 14px;">DOCS</span>
</a>
<div class="nav-group">
<span class="nav-label">Documentation</span>
{% for doc in docs %}
<a href="/docs/{{ doc.id }}" class="nav-item {% if current_doc == doc.id %}active{% endif %}">
{{ doc.title }}
</a>
{% endfor %}
</div>
<div class="nav-group" style="margin-top: auto; padding-top: 40px;">
<a href="/" class="nav-item" style="color: var(--text-muted);">← Back to Hub</a>
</div>
</aside>
<main>
<article class="markdown-body">
{{ content | safe }}
</article>
</main>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10.9.1/dist/mermaid.min.js"></script>
<script>
mermaid.initialize({
startOnLoad: false,
theme: 'neutral',
securityLevel: 'loose',
fontFamily: 'Inter'
});
async function renderMermaid() {
const blocks = document.querySelectorAll('pre code');
const keywords = [
'graph ', 'sequenceDiagram', 'gantt', 'classDiagram',
'stateDiagram', 'pie', 'flowchart', 'erDiagram', 'mindmap', 'gitGraph', 'mermaid'
];
for (const block of blocks) {
const text = block.textContent.trim();
const hasKeyword = keywords.some(k => text.startsWith(k) || text.includes('\n' + k) || text.startsWith('---'));
const isMermaid =
block.classList.contains('language-mermaid') ||
block.classList.contains('mermaid') ||
text.includes('graph ') ||
hasKeyword;
if (isMermaid) {
const div = document.createElement('div');
div.className = 'mermaid';
div.style.background = 'white';
div.style.padding = '20px';
div.style.borderRadius = '12px';
div.style.marginBottom = '20px';
div.textContent = text.replace(/^mermaid\n/, '');
let target = block.parentElement; // the 'pre'
if (target.parentElement && target.parentElement.classList.contains('codehilite')) {
target = target.parentElement;
}
target.replaceWith(div);
}
}
// Small delay to ensure DOM replacement is finished
setTimeout(async () => {
try {
await mermaid.run();
} catch (err) {
console.error('Mermaid render failed:', err);
}
}, 100);
}
document.addEventListener('DOMContentLoaded', renderMermaid);
</script>
</body>
</html>