Files
2025-11-30 08:56:03 +08:00

484 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Topic Name - Documentation</title>
<!-- Mermaid.js -->
<script src="https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js"></script>
<!-- Syntax highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
line-height: 1.6;
color: #333;
background: #f8f9fa;
}
.container {
max-width: 1200px;
margin: 0 auto;
display: grid;
grid-template-columns: 250px 1fr;
gap: 2rem;
}
/* Header */
header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 3rem 2rem;
text-align: center;
}
header h1 {
font-size: 2.5rem;
margin-bottom: 0.5rem;
font-weight: 700;
}
header p {
font-size: 1.1rem;
opacity: 0.9;
}
/* Navigation */
nav {
position: sticky;
top: 2rem;
height: fit-content;
background: white;
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
nav h3 {
margin-bottom: 1rem;
font-size: 0.875rem;
text-transform: uppercase;
color: #667eea;
letter-spacing: 0.05em;
}
nav ul {
list-style: none;
}
nav a {
display: block;
padding: 0.5rem 0.75rem;
color: #555;
text-decoration: none;
border-radius: 4px;
transition: all 0.2s;
font-size: 0.95rem;
}
nav a:hover {
background: #f0f0f0;
color: #667eea;
padding-left: 1rem;
}
nav a.active {
background: #667eea;
color: white;
}
/* Main content */
main {
background: white;
padding: 3rem;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
margin: 2rem 0;
}
section {
margin-bottom: 4rem;
scroll-margin-top: 2rem;
}
section:last-child {
margin-bottom: 0;
}
h2 {
font-size: 2rem;
margin-bottom: 1rem;
color: #667eea;
padding-bottom: 0.5rem;
border-bottom: 2px solid #e0e0e0;
}
h3 {
font-size: 1.5rem;
margin: 2rem 0 1rem;
color: #444;
}
h4 {
font-size: 1.2rem;
margin: 1.5rem 0 0.75rem;
color: #555;
}
p {
margin-bottom: 1rem;
}
ul, ol {
margin: 1rem 0 1rem 2rem;
}
li {
margin-bottom: 0.5rem;
}
/* Code blocks */
pre {
background: #f6f8fa;
border: 1px solid #e1e4e8;
border-radius: 6px;
padding: 1rem;
overflow-x: auto;
margin: 1rem 0;
}
code {
background: #f6f8fa;
padding: 0.2rem 0.4rem;
border-radius: 3px;
font-family: 'Monaco', 'Courier New', monospace;
font-size: 0.9em;
}
pre code {
background: none;
padding: 0;
}
/* Mermaid diagrams */
.mermaid {
background: #fafafa;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 2rem;
margin: 2rem 0;
text-align: center;
}
/* Info boxes */
.info-box {
background: #e6f3ff;
border-left: 4px solid #667eea;
padding: 1rem 1.5rem;
margin: 1.5rem 0;
border-radius: 4px;
}
.info-box.warning {
background: #fff4e6;
border-left-color: #ff9800;
}
.info-box.tip {
background: #e6ffe6;
border-left-color: #4caf50;
}
.info-box h4 {
margin-top: 0;
}
/* Tables */
table {
width: 100%;
border-collapse: collapse;
margin: 1.5rem 0;
}
th, td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid #e0e0e0;
}
th {
background: #f6f8fa;
font-weight: 600;
color: #555;
}
tr:hover {
background: #f9f9f9;
}
/* Responsive */
@media (max-width: 768px) {
.container {
grid-template-columns: 1fr;
}
nav {
position: static;
order: -1;
}
main {
padding: 1.5rem;
}
header h1 {
font-size: 1.8rem;
}
}
/* Print styles */
@media print {
body {
background: white;
}
.container {
display: block;
}
nav {
display: none;
}
main {
box-shadow: none;
padding: 0;
}
section {
page-break-inside: avoid;
}
h2 {
page-break-after: avoid;
}
}
</style>
</head>
<body>
<header>
<h1>Topic Name</h1>
<p>A comprehensive guide for understanding and working with [feature/concept]</p>
</header>
<div class="container">
<nav>
<h3>Contents</h3>
<ul>
<li><a href="#overview">Overview</a></li>
<li><a href="#architecture">Architecture</a></li>
<li><a href="#use-cases">Use Cases</a></li>
<li><a href="#examples">Code Examples</a></li>
<li><a href="#next-steps">Next Steps</a></li>
</ul>
</nav>
<main>
<section id="overview">
<h2>Overview</h2>
<p>
Brief introduction to the topic. Explain what it is, why it matters, and what this document covers.
</p>
<div class="info-box">
<h4>Key Concepts</h4>
<ul>
<li>Concept 1: Brief explanation</li>
<li>Concept 2: Brief explanation</li>
<li>Concept 3: Brief explanation</li>
</ul>
</div>
</section>
<section id="architecture">
<h2>Architecture</h2>
<p>
High-level architecture explanation with visual diagrams.
</p>
<div class="mermaid">
graph TB
subgraph "Frontend Layer"
A[Web Client]
B[Mobile App]
end
subgraph "Application Layer"
C[API Gateway]
D[Service 1]
E[Service 2]
end
subgraph "Data Layer"
F[(Database)]
G[(Cache)]
end
A --> C
B --> C
C --> D
C --> E
D --> F
E --> F
D --> G
style A fill:#FFE6E6
style B fill:#FFE6E6
style C fill:#E6F3FF
style D fill:#E6FFE6
style E fill:#E6FFE6
style F fill:#FFF4E6
style G fill:#FFF4E6
</div>
<h3>Component Relationships</h3>
<p>Detailed explanation of how components interact...</p>
</section>
<section id="use-cases">
<h2>Use Cases</h2>
<h3>Use Case 1: Primary Workflow</h3>
<p>Description of the main use case and workflow.</p>
<div class="mermaid">
sequenceDiagram
participant User
participant Frontend
participant API
participant Database
User->>Frontend: Initiates action
Frontend->>API: POST /api/action
API->>Database: Query data
Database-->>API: Return results
API-->>Frontend: JSON response
Frontend-->>User: Display result
</div>
<h3>Use Case 2: Alternative Scenario</h3>
<p>Another common scenario and how it works...</p>
</section>
<section id="examples">
<h2>Code Examples</h2>
<h3>Basic Example</h3>
<pre><code class="language-javascript">// Example code with syntax highlighting
function example() {
const data = fetchData();
return processData(data);
}
</code></pre>
<div class="info-box tip">
<h4>Best Practice</h4>
<p>Always validate input before processing...</p>
</div>
<h3>Advanced Example</h3>
<pre><code class="language-javascript">// More complex example
class AdvancedFeature {
constructor(config) {
this.config = config;
}
async process() {
// Implementation details
}
}
</code></pre>
</section>
<section id="next-steps">
<h2>Next Steps</h2>
<p>Practical exercises and further learning resources.</p>
<h3>Practice Exercises</h3>
<ol>
<li>Exercise 1: Build a simple implementation</li>
<li>Exercise 2: Add advanced features</li>
<li>Exercise 3: Optimize performance</li>
</ol>
<h3>Further Reading</h3>
<ul>
<li>Documentation link 1</li>
<li>Documentation link 2</li>
<li>Related topics</li>
</ul>
</section>
</main>
</div>
<script>
// Initialize Mermaid with pastel theme
mermaid.initialize({
startOnLoad: true,
theme: 'base',
themeVariables: {
primaryColor: '#FFE6E6',
primaryTextColor: '#333',
primaryBorderColor: '#999',
lineColor: '#666',
secondaryColor: '#E6F3FF',
tertiaryColor: '#E6FFE6',
quaternaryColor: '#FFF4E6',
quinaryColor: '#F0E6FF',
fontFamily: 'Inter, sans-serif'
}
});
// Initialize syntax highlighting
hljs.highlightAll();
// Smooth scroll for navigation links
document.querySelectorAll('nav a').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
const target = document.querySelector(link.getAttribute('href'));
target.scrollIntoView({ behavior: 'smooth' });
});
});
// Active section highlighting in nav
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const id = entry.target.getAttribute('id');
document.querySelectorAll('nav a').forEach(link => {
link.classList.remove('active');
});
document.querySelector(`nav a[href="#${id}"]`)?.classList.add('active');
}
});
}, { threshold: 0.5 });
document.querySelectorAll('section').forEach(section => {
observer.observe(section);
});
</script>
</body>
</html>