Since I need to create a striking, modern frontend that's not template-y, I'll create:
Let me create a polished documentation portal with real content and interactions.
I'll create a sophisticated documentation portal with MDX content rendering, API schema explorer, and changelog automation - featuring a technical, polished design.
html Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Docs API Portal</title>
<script src="https://cdn.tailwindcss.com"></script>
<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=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0a0e14;
--bg-elevated: #0f1419;
--bg-card: #151b23;
--fg: #e6edf3;
--fg-muted: #7d8590;
--accent: #00d9a5;
--accent-dim: #00d9a520;
--border: #21262d;
--code-bg: #161b22;
--warning: #f0883e;
--error: #f85149;
--success: #3fb950;
--info: #58a6ff;
}
* {
box-sizing: border-box;
}
body {
font-family: 'Space Grotesk', sans-serif;
background: var(--bg);
color: var(--fg);
margin: 0;
overflow-x: hidden;
}
.font-mono {
font-family: 'JetBrains Mono', monospace;
}
.bg-grid {
background-image:
linear-gradient(rgba(0, 217, 165, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 217, 165, 0.03) 1px, transparent 1px);
background-size: 32px 32px;
}
.glow-accent {
box-shadow: 0 0 40px rgba(0, 217, 165, 0.15);
}
.code-block {
background: var(--code-bg);
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
}
.code-header {
background: rgba(255,255,255,0.03);
border-bottom: 1px solid var(--border);
padding: 8px 12px;
display: flex;
align-items: center;
gap: 8px;
}
.method-badge {
font-size: 11px;
font-weight: 600;
padding: 2px 8px;
border-radius: 4px;
text-transform: uppercase;
}
.method-get { background: #3fb95020; color: #3fb950; }
.method-post { background: #58a6ff20; color: #58a6ff; }
.method-put { background: #f0883e20; color: #f0883e; }
.method-delete { background: #f8514920; color: #f85149; }
.sidebar-link {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
border-radius: 6px;
color: var(--fg-muted);
text-decoration: none;
transition: all 0.15s;
font-size: 14px;
}
.sidebar-link:hover {
background: rgba(255,255,255,0.05);
color: var(--fg);
}
.sidebar-link.active {
background: var(--accent-dim);
color: var(--accent);
}
.toc-link {
color: var(--fg-muted);
text-decoration: none;
font-size: 13px;
padding: 4px 0;
display: block;
border-left: 2px solid transparent;
padding-left: 12px;
transition: all 0.15s;
}
.toc-link:hover, .toc-link.active {
color: var(--accent);
border-left-color: var(--accent);
}
.version-badge {
display: inline-flex;
align-items: center;
gap: 6px;
background: var(--accent-dim);
color: var(--accent);
padding: 4px 10px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--success);
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.changelog-item {
position: relative;
padding-left: 24px;
}
.changelog-item::before {
content: '';
position: absolute;
left: 0;
top: 8px;
width: 10px;
height: 10px;
border-radius: 50%;
border: 2px solid var(--accent);
background: var(--bg);
}
.changelog-item::after {
content: '';
position: absolute;
left: 4px;
top: 22px;
width: 2px;
height: calc(100% - 14px);
background: var(--border);
}
.changelog-item:last-child::after {
display: none;
}
.search-modal {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.7);
backdrop-filter: blur(4px);
z-index: 100;
display: none;
align-items: flex-start;
justify-content: center;
padding-top: 15vh;
}
.search-modal.open {
display: flex;
}
.search-box {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
width: 100%;
max-width: 600px;
overflow: hidden;
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.schema-tree {
font-family: 'JetBrains Mono', monospace;
font-size: 13px;
line-height: 1.8;
}
.schema-key { color: #79c0ff; }
.schema-type { color: #ff7b72; }
.schema-string { color: #a5d6ff; }
.schema-number { color: #ffa657; }
.schema-boolean { color: #ff7b72; }
.tab-btn {
padding: 10px 16px;
background: transparent;
border: none;
color: var(--fg-muted);
cursor: pointer;
font-family: inherit;
font-size: 14px;
font-weight: 500;
position: relative;
transition: color 0.15s;
}
.tab-btn:hover {
color: var(--fg);
}
.tab-btn.active {
color: var(--accent);
}
.tab-btn.active::after {
content: '';
position: absolute;
bottom: 0;
left: 16px;
right: 16px;
height: 2px;
background: var(--accent);
border-radius: 2px 2px 0 0;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.animate-in {
animation: fadeInUp 0.5s ease forwards;
}
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: var(--bg);
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--fg-muted);
}
.sync-indicator {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: rgba(0, 217, 165, 0.1);
border: 1px solid rgba(0, 217, 165, 0.2);
border-radius: 6px;
font-size: 13px;
color: var(--accent);
}
.sync-spin {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
</style>
</head>
<body class="bg-grid min-h-screen">
<!-- Header -->
<header class="fixed top-0 left-0 right-0 z-50 border-b border-[var(--border)] bg-[var(--bg)]/90 backdrop-blur-md">
<div class="flex items-center justify-between px-6 h-16">
<div class="flex items-center gap-8">
<a href="#" class="flex items-center gap-3">
<div class="w-8 h-8 rounded-lg bg-[var(--accent)] flex items-center justify-center">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#0a0e14" stroke-width="2.5">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
</svg>
</div>
<span class="font-semibold text-lg">DocSync</span>
</a>
<nav class="hidden md:flex items-center gap-1">
<button class="tab-btn active" data-section="docs">Documentation</button>
<button class="tab-btn" data-section="api">API Reference</button>
<button class="tab-btn" data-section="changelog">Changelog</button>
</nav>
</div>
<div class="flex items-center gap-4">
<button id="searchBtn" class="flex items-center gap-2 px-3 py-2 rounded-lg border border-[var(--border)] bg-[var(--bg-card)] text-[var(--fg-muted)] text-sm hover:border-[var(--accent)] transition-colors">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>
</svg>
<span class="hidden sm:inline">Search</span>
<kbd class="hidden sm:inline-flex items-center px-1.5 py-0.5 text-xs bg-[var(--bg)] rounded border border-[var(--border)]">K</kbd>
</button>
<div class="sync-indicator">
<svg class="sync-spin" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 12a9 9 0 1 1-6.219-8.56"/>
</svg>
<span>Syncing...</span>
</div>
<a href="#" class="hidden sm:flex items-center gap-2 px-4 py-2 rounded-lg bg-[var(--accent)] text-[var(--bg)] font-semibold text-sm hover:opacity-90 transition-opacity">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/>
</svg>
GitHub
</a>
</div>
</div>
</header>
<div class="flex pt-16">
<!-- Sidebar -->
<aside id="sidebar" class="fixed left-0 top-16 bottom-0 w-64 border-r border-[var(--border)] bg-[var(--bg-elevated)] overflow-y-auto hidden lg:block">
<div class="p-4">
<div class="flex items-center justify-between mb-4">
<span class="version-badge">
<status-dot></status-dot>
v2.4.1
</span>
<select class="bg-transparent border border-[var(--border)] rounded px-2 py-1 text-xs text-[var(--fg-muted)]">
<option>v2.4.1 (latest)</option>
<option>v2.3.0</option>
<option>v2.2.0</option>
</select>
</div>
<nav class="space-y-1">
<div class="pt-2 pb-2">
<span class="text-xs font-semibold text-[var(--fg-muted)] uppercase tracking-wider">Getting Started</span>
</div>
<a href="#" class="sidebar-link active">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
</svg>
Introduction
</a>
<a href="#" class="sidebar-link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 20V10M18 20V4M6 20v-4"/>
</svg>
Quick Start
</a>
<a href="#" class="sidebar-link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2"/>
<path d="M3 9h18M9 21V9"/>
</svg>
Configuration
</a>
<div class="pt-4 pb-2">
<span class="text-xs font-semibold text-[var(--fg-muted)] uppercase tracking-wider">Core Concepts</span>
</div>
<a href="#" class="sidebar-link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
MDX Content
</a>
<a href="#" class="sidebar-link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
</svg>
API Schemas
</a>
<a href="#" class="sidebar-link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"/>
</svg>
Automation
</a>
<div class="pt-4 pb-2">
<span class="text-xs font-semibold text-[var(--fg-muted)] uppercase tracking-wider">Integrations</span>
</div>
<a href="#" class="sidebar-link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<path d="M12 6v6l4 2"/>
</svg>
Webhooks
</a>
<a href="#" class="sidebar-link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>
<polyline points="22,6 12,13 2,6"/>
</svg>
Notifications
</a>
</nav>
</div>
</aside>
<!-- Main Content -->
<main class="flex-1 lg:ml-64 lg:mr-56">
<!-- Documentation Section -->
<section id="docsSection" class="p-6 lg:p-10 max-w-4xl mx-auto">
<div class="animate-in delay-1">
<div class="flex items-center gap-3 text-[var(--fg-muted)] text-sm mb-4">
<span>Docs</span>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 18l6-6-6-6"/>
</svg>
<span>Getting Started</span>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 18l6-6-6-6"/>
</svg>
<span class="text-[var(--fg)]">Introduction</span>
</div>
<h1 class="text-4xl lg:text-5xl font-bold mb-4 leading-tight">
Welcome to <span class="text-[var(--accent)]">DocSync</span>
</h1>
<p class="text-xl text-[var(--fg-muted)] mb-8">
A unified documentation platform that syncs MDX content, API schemas, and automates your changelog generation.
</p>
</div>
<div class="animate-in delay-2 grid grid-cols-1 md:grid-cols-3 gap-4 mb-10">
<div class="p-5 rounded-xl border border-[var(--border)] bg-[var(--bg-card)] hover:border-[var(--accent)] transition-colors group cursor-pointer">
<div class="w-10 h-10 rounded-lg bg-[#3fb95020] flex items-center justify-center mb-3 group-hover:scale-110 transition-transform">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#3fb950" stroke-width="2">
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
</div>
<h3 class="font-semibold mb-1">MDX Sync</h3>
<p class="text-sm text-[var(--fg-muted)]">Write docs in MDX with live code blocks and interactive components.</p>
</div>
<div class="p-5 rounded-xl border border-[var(--border)] bg-[var(--bg-card)] hover:border-[var(--accent)] transition-colors group cursor-pointer">
<div class="w-10 h-10 rounded-lg bg-[#58a6ff20] flex items-center justify-center mb-3 group-hover:scale-110 transition-transform">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#58a6ff" stroke-width="2">
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
</svg>
</div>
<h3 class="font-semibold mb-1">API Schemas</h3>
<p class="text-sm text-[var(--fg-muted)]">Auto-generate API docs from OpenAPI, Swagger, or GraphQL schemas.</p>
</div>
<div class="p-5 rounded-xl border border-[var(--border)] bg-[var(--bg-card)] hover:border-[var(--accent)] transition-colors group cursor-pointer">
<div class="w-10 h-10 rounded-lg bg-[#f0883e20] flex items-center justify-center mb-3 group-hover:scale-110 transition-transform">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#f0883e" stroke-width="2">
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"/>
</svg>
</div>
<h3 class="font-semibold mb-1">Changelog</h3>
<p class="text-sm text-[var(--fg-muted)]">Automated changelog from git commits and conventional commits.</p>
</div>
</div>
<div class="animate-in delay-3">
<h2 class="text-2xl font-bold mb-4">Quick Start</h2>
<div class="code-block mb-6">
<div class="code-header">
<span class="text-xs text-[var(--fg-muted)]">terminal</span>
<button class="copy-btn ml-auto text-xs text-[var(--fg-muted)] hover:text-[var(--fg)] transition-colors" data-code="npm install @docsync/cli">
Copy
</button>
</div>
<pre class="p-4 text-sm font-mono overflow-x-auto"><code><span class="text-[var(--fg-muted)]">$</span> npm install <span class="text-[var(--accent)]">@docsync/cli</span> --save-dev
<span class="text-[var(--fg-muted)]">$</span> npx docsync init</code></pre>
</div>
<p class="text-[var(--fg-muted)] mb-6">
This creates a <code class="px-1.5 py-0.5 rounded bg-[var(--code-bg)] text-[var(--accent)] font-mono text-sm">docsync.config.yaml</code> file in your project root.
Configure your content sources and sync settings:
</p>
<div class="code-block mb-6">
<div class="code-header">
<span class="text-xs text-[var(--fg-muted)]">docsync.config.yaml</span>
<button class="copy-btn ml-auto text-xs text-[var(--fg-muted)] hover:text-[var(--fg)] transition-colors" data-code="content:
mdx: ./docs
schemas:
- ./api/openapi.yaml
- ./api/graphql/schema.gql
sync:
interval: 5m
webhook: https://api.example.com/sync">
Copy
</button>
</div>
<pre class="p-4 text-sm font-mono overflow-x-auto"><code><span class="text-[#ff7b72]">content</span>:
<span class="text-[#ff7b72]">mdx</span>: <span class="text-[#a5d6ff]">./docs</span>
<span class="text-[#ff7b72]">schemas</span>:
- <span class="text-[#a5d6ff]">./api/openapi.yaml</span>
- <span class="text-[#a5d6ff]">./api/graphql/schema.gql</span>
<span class="text-[#ff7b72]">sync</span>:
<span class="text-[#ff7b72]">interval</span>: <span class="text-[#a5d6ff]">5m</span>
<span class="text-[#ff7b72]">webhook</span>: <span class="text-[#a5d6ff]">https://api.example.com/sync</span></code></pre>
</div>
</div>
<div class="animate-in delay-4 mt-10 p-6 rounded-xl border border-[var(--border)] bg-[var(--bg-card)]">
<div class="flex items-start gap-4">
<div class="w-10 h-10 rounded-full bg-[var(--info)]20 flex items-center justify-center flex-shrink-0">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#58a6ff" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<path d="M12 16v-4M12 8h.01"/>
</svg>
</div>
<div>
<h4 class="font-semibold mb-1">Need help getting started?</h4>
<p class="text-sm text-[var(--fg-muted)] mb-3">Join our community Discord or check out example projects on GitHub.</p>
<div class="flex gap-3">
<a href="#" class="text-sm text-[var(--accent)] hover:underline">View Examples</a>
<a href="#" class="text-sm text-[var(--accent)] hover:underline">Join Discord</a>
</div>
</div>
</div>
</div>
</section>
<!-- API Reference Section -->
<section id="apiSection" class="p-6 lg:p-10 max-w-4xl mx-auto hidden">
<div class="mb-8">
<h1 class="text-4xl font-bold mb-4">API Reference</h1>
<p class="text-[var(--fg-muted)]">Complete API reference auto-generated from your OpenAPI schemas.</p>
</div>
<div class="flex items-center gap-4 mb-6 p-4 rounded-xl border border-[var(--border)] bg-[var(--bg-card)]">
<input type="text" placeholder="Filter endpoints..." class="flex-1 bg-transparent border-none outline-none text-sm" id="apiFilter">
<div class="flex gap-2">
<button class="filter-btn active px-3 py-1 rounded-full text-xs border border-[var(--border)]" data-filter="all">All</button>
<button class="filter-btn px-3 py-1 rounded-full text-xs border border-[var(--border)]" data-filter="get">GET</button>
<button class="filter-btn px-3 py-1 rounded-full text-xs border border-[var(--border)]" data-filter="post">POST</button>
<button class="filter-btn px-3 py-1 rounded-full text-xs border border-[var(--border)]" data-filter="put">PUT</button>
<button class="filter-btn px-3 py-1 rounded-full text-xs border border-[var(--border)]" data-filter="delete">DELETE</button>
</div>
</div>
<div id="apiEndpoints" class="space-y-4">
<!-- Endpoints will be rendered here -->
</div>
</section>
<!-- Changelog Section -->
<section id="changelogSection" class="p-6 lg:p-10 max-w-4xl mx-auto hidden">
<div class="flex items-center justify-between mb-8">
<div>
<h1 class="text-4xl font-bold mb-4">Changelog</h1>
<p class="text-[var(--fg-muted)]">Automated release notes generated from conventional commits.</p>
</div>
<div class="flex items-center gap-2">
<select class="bg-[var(--bg-card)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm">
<option>All Versions</option>
<option>v2.x</option>
<option>v1.x</option>
</select>
</div>
</div>
<div id="changelogList" class="space-y-8">
<!-- Changelog items will be rendered here -->
</div>
</section>
</main>
<!-- Table of Contents -->
<aside class="fixed right-0 top-16 bottom-0 w-56 border-l border-[var(--border)] bg-[var(--bg-elevated)] overflow-y-auto hidden xl:block">
<div class="p-4">
<span class="text-xs font-semibold text-[var(--fg-muted)] uppercase tracking-wider">On This Page</span>
<nav class="mt-4 space-y-1" id="tocNav">
<a href="#" class="toc-link active">Introduction</a>
<a href="#" class="toc-link">Quick Start</a>
<a href="#" class="toc-link">Configuration</a>
<a href="#" class="toc-link">Next Steps</a>
</nav>
<div class="mt-8 p-3 rounded-lg border border-[var(--border)] bg-[var(--bg)]">
<span class="text-xs text-[var(--fg-muted)]">Last updated</span>
<p class="text-sm mt-1">2 hours ago</p>
<a href="#" class="text-xs text-[var(--accent)] hover:underline mt-2 inline-block">Edit this page</a>
</div>
</div>
</aside>
</div>
<!-- Search Modal -->
<div class="search-modal" id="searchModal">
<div class="search-box">
<div class="p-4 border-b border-[var(--border)]">
<div class="flex items-center gap-3">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="var(--fg-muted)" stroke-width="2">
<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>
</svg>
<input type="text" placeholder="Search documentation..." class="flex-1 bg-transparent border-none outline-none text-lg" id="searchInput" autofocus>
<kbd class="px-2 py-1 text-xs bg-[var(--bg)] rounded border border-[var(--border)]">ESC</kbd>
</div>
</div>
<div class="p-2 max-h-80 overflow-y-auto" id="searchResults">
<div class="px-3 py-2 text-xs text-[var(--fg-muted)] uppercase">Quick Actions</div>
<button class="w-full px-3 py-2 text-left text-sm rounded-lg hover:bg-[var(--bg)] flex items-center gap-3">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
</svg>
Getting Started
</button>
<button class="w-full px-3 py-2 text-left text-sm rounded-lg hover:bg-[var(--bg)] flex items-center gap-3">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
</svg>
API Reference
</button>
<button class="w-full px-3 py-2 text-left text-sm rounded-lg hover:bg-[var(--bg)] flex items-center gap-3">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<path d="M12 6v6l4 2"/>
</svg>
Changelog
</button>
</div>
</div>
</div>
<script>
// Data
const apiEndpoints = [
{
method: 'GET',
path: '/api/v1/documents',
description: 'List all documents with pagination support',
auth: true,
params: [
{ name: 'page', type: 'integer', description: 'Page number' },
{ name: 'limit', type: 'integer', description: 'Items per page' },
{ name: 'sort', type: 'string', description: 'Sort field' }
],
response: {
data: [{ id: 'string', title: 'string', content: 'string' }],
meta: { total: 'integer', page: 'integer' }
}
},
{
method: 'POST',
path: '/api/v1/documents',
description: 'Create a new document from MDX content',
auth: true,
body: { title: 'string', content: 'string', tags: ['string'] },
response: { id: 'string', createdAt: 'string' }
},
{
method: 'GET',
path: '/api/v1/schemas/{schemaId}',
description: 'Retrieve API schema by ID',
auth: true,
params: [
{ name: 'schemaId', type: 'string', description: 'Schema UUID' }
],
response: { id: 'string', type: 'string', spec: 'object' }
},
{
method: 'PUT',
path: '/api/v1/documents/{docId}',
description: 'Update an existing document',
auth: true,
params: [
{ name: 'docId', type: 'string', description: 'Document UUID' }
],
body: { title: 'string', content: 'string' },
response: { id: 'string', updatedAt: 'string' }
},
{
method: 'DELETE',
path: '/api/v1/documents/{docId}',
description: 'Delete a document',
auth: true,
params: [
{ name: 'docId', type: 'string', description: 'Document UUID' }
],
response: { success: 'boolean' }
},
{
method: 'POST',
path: '/api/v1/sync/webhook',
description: 'Trigger sync webhook for content update',
auth: false,
body: { event: 'string', payload: 'object' },
response: { received: 'boolean', timestamp: 'string' }
}
];
const changelogData = [
{
version: '2.4.1',
date: '2024-01-15',
changes: [
{ type: 'fix', text: 'Fixed MDX parsing issue with nested code blocks' },
{ type: 'fix', text: 'Resolved sync conflict detection false positives' },
{ type: 'improve', text: 'Improved schema validation error messages' }
]
},
{
version: '2.4.0',
date: '2024-01-10',
changes: [
{ type: 'feat', text: 'Added GraphQL schema support for API documentation' },
{ type: 'feat', text: 'New webhook integration for real-time sync notifications' },
{ type: 'feat', text: 'Custom theme support for documentation sites' },
{ type: 'break', text: 'Dropped support for Node.js 16.x' }
]
},
{
version: '2.3.0',
date: '2024-01-02',
changes: [
{ type: 'feat', text: 'Automatic changelog generation from conventional commits' },
{ type: 'improve', text: '50% faster schema parsing with lazy loading' },
{ type: 'fix', text: 'Fixed sidebar navigation on mobile devices' }
]
},
{
version: '2.2.0',
date: '2023-12-20',
changes: [
{ type: 'feat', text: 'Multi-version documentation support' },
{ type: 'feat', text: 'API playground for interactive testing' },
{ type: 'improve', text: 'Better search with fuzzy matching' }
]
}
];
// Initialize DOM references
const searchModal = document.getElementById('searchModal');
const searchBtn = document.getElementById('searchBtn');
const searchInput = document.getElementById('searchInput');
const tabBtns = document.querySelectorAll('.tab-btn');
const filterBtns = document.querySelectorAll('.filter-btn');
const apiFilter = document.getElementById('apiFilter');
const copyBtns = document.querySelectorAll('.copy-btn');
// Section switching
function switchSection(section) {
document.querySelectorAll('main > section').forEach(s => s.classList.add('hidden'));
document.getElementById(`${section}Section`).classList.remove('hidden');
tabBtns.forEach(btn => {
btn.classList.toggle('active', btn.dataset.section === section);
});
}
tabBtns.forEach(btn => {
btn.addEventListener('click', () => switchSection(btn.dataset.section));
});
// Search modal
searchBtn.addEventListener('click', () => {
searchModal.classList.add('open');
searchInput.focus();
});
searchModal.addEventListener('click', (e) => {
if (e.target === searchModal) {
searchModal.classList.remove('open');
}
});
document.addEventListener('keydown', (e) => {
if (e.key === 'k' && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
searchModal.classList.toggle('open');
if (searchModal.classList.contains('open')) {
searchInput.focus();
}
}
if (e.key === 'Escape') {
searchModal.classList.remove('open');
}
});
// Copy buttons
copyBtns.forEach(btn => {
btn.addEventListener('click', () => {
const code = btn.dataset.code;
navigator.clipboard.writeText(code);
btn.textContent = 'Copied!';
setTimeout(() => btn.textContent = 'Copy', 2000);
});
});
// Render API endpoints
function renderApiEndpoints(filter = 'all') {
const container = document.getElementById('apiEndpoints');
const searchTerm = apiFilter ? apiFilter.value.toLowerCase() : '';
const filtered = apiEndpoints.filter(ep => {
const matchesFilter = filter === 'all' || ep.method.toLowerCase() === filter;
const matchesSearch = ep.path.toLowerCase().includes(searchTerm) ||
ep.description.toLowerCase().includes(searchTerm);
return matchesFilter && matchesSearch;
});
container.innerHTML = filtered.map(ep => `
<div class="rounded-xl border border-[var(--border)] bg-[var(--bg-card)] overflow-hidden">
<div class="p-4 border-b border-[var(--border)] flex items-center justify-between">
<div class="flex items-center gap-3">
<span class="method-badge method-${ep.method.toLowerCase()}">${ep.method}</span>
<code class="font-mono text-sm">${ep.path}</code>
</div>
${ep.auth ? '<span class="text-xs px-2 py-1 rounded bg-[var(--warning)]20 text-[var(--warning)]">Auth Required</span>' : ''}
</div>
<div class="p-4">
<p class="text-[var(--fg-muted)] text-sm mb-4">${ep.description}</p>
${ep.params ? `
<div class="mb-4">
<span class="text-xs font-semibold text-[var(--fg-muted)] uppercase">Parameters</span>
<div class="mt-2 space-y-2">
${ep.params.map(p => `
<div class="flex items-center gap-3 text-sm">
<code class="font-mono text-[var(--accent)]">${p.name}</code>
<span class="text-xs px-1.5 py-0.5 rounded bg-[var(--code-bg)] text-[var(--fg-muted)]">${p.type}</span>
<span class="text-[var(--fg-muted)]">${p.description}</span>
</div>
`).join('')}
</div>
</div>
` : ''}
<div>
<span class="text-xs font-semibold text-[var(--fg-muted)] uppercase">Response Schema</span>
<div class="code-block mt-2">
<pre class="p-3 text-xs font-mono overflow-x-auto schema-tree">${formatSchema(ep.response)}</pre>
</div>
</div>
</div>
</div>
`).join('');
}
function formatSchema(obj, indent = 0) {
if (!obj) return '';
const spaces = ' '.repeat(indent);
let result = '';
for (const [key, value] of Object.entries(obj)) {
if (typeof value === 'object' && !Array.isArray(value)) {
result += `${spaces}<span class="schema-key">${key}</span>: {\n${formatSchema(value, indent + 1)}${spaces}}\n`;
} else if (Array.isArray(value)) {
result += `${spaces}<span class="schema-key">${key}</span>: [\n`;
if (value.length > 0 && typeof value[0] === 'object') {
result += `${spaces} {\n${formatSchema(value[0], indent + 2)}${spaces} }\n`;
}
result += `${spaces}]\n`;
} else {
const typeClass = value === 'string' ? 'schema-string' :
value === 'integer' || value === 'number' ? 'schema-number' :
value === 'boolean' ? 'schema-boolean' : 'schema-type';
result += `${spaces}<span class="schema-key">${key}</span>: <span class="${typeClass}">${value}</span>\n`;
}
}
return result;
}
// Render changelog
function renderChangelog() {
const container = document.getElementById('changelogList');
const typeStyles = {
feat: { bg: 'bg-[#3fb950]20', text: 'text-[#3fb950]', label: 'Feature' },
fix: { bg: 'bg-[#58a6ff]20', text: 'text-[#58a6ff]', label: 'Fix' },
improve: { bg: 'bg-[#f0883e]20', text: 'text-[#f0883e]', label: 'Improvement' },
break: { bg: 'bg-[#f85149]20', text: 'text-[#f85149]', label: 'Breaking' }
};
container.innerHTML = changelogData.map(release => `
<div class="changelog-item pb-8">
<div class="flex items-center gap-3 mb-4">
<span class="version-badge">
<status-dot></status-dot>
${release.version}
</span>
<span class="text-sm text-[var(--fg-muted)]">${release.date}</span>
</div>
<div class="space-y-3">
${release.changes.map(change => {
const style = typeStyles[change.type] || typeStyles.improve;
return `
<div class="flex items-start gap-3 p-3 rounded-lg border border-[var(--border)] bg-[var(--bg-card)]">
<span class="text-xs px-2 py-0.5 rounded ${style.bg} ${style.text} font-medium">${style.label}</span>
<p class="text-sm">${change.text}</p>
</div>
`;
}).join('')}
</div>
</div>
`).join('');
}
// Filter buttons
filterBtns.forEach(btn => {
btn.addEventListener('click', () => {
filterBtns.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
renderApiEndpoints(btn.dataset.filter);
});
});
// API filter input
if (apiFilter) {
apiFilter.addEventListener('input', () => {
const activeFilter = document.querySelector('.filter-btn.active');
renderApiEndpoints(activeFilter ? activeFilter.dataset.filter : 'all');
});
}
// Sidebar links
document.querySelectorAll('.sidebar-link').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
document.querySelectorAll('.sidebar-link').forEach(l => l.classList.remove('active'));
link.classList.add('active');
});
});
// TOC links
document.querySelectorAll('.toc-link').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
document.querySelectorAll('.toc-link').forEach(l => l.classList.remove('active'));
link.classList.add('active');
});
});
// Intersection Observer for scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-in');
}
});
}, observerOptions);
document.querySelectorAll('.animate-in').forEach(el => {
observer.observe(el);
});
// Initialize
renderApiEndpoints();
renderChangelog();
// Simulate sync complete
setTimeout(() => {
const syncIndicator = document.querySelector('.sync-indicator');
if (syncIndicator) {
syncIndicator.innerHTML = `
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 6L9 17l-5-5"/>
</svg>
<span>Synced</span>
`;
syncIndicator.style.background = 'rgba(63, 185, 80, 0.1)';
syncIndicator.style.borderColor = 'rgba(63, 185, 80, 0.2)';
syncIndicator.style.color = '#3fb950';
}
}, 3000);
</script>
</body>
</html>