Repository navigation
Expand file tree
/
Copy pathdocs.html
More file actions
541 lines (463 loc) · 19.4 KB
/
Copy pathdocs.html
File metadata and controls
541 lines (463 loc) · 19.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NovariaOS - Docs</title>
<!-- Load Tailwind CSS -->
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<!-- Load JetBrains Mono Font -->
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap" rel="stylesheet">
<style>
/* Base styles matching the Novaria aesthetic */
body {
font-family: 'JetBrains Mono', monospace;
background-color: #101010; /* Dark background */
color: #FAF9F6; /* Light text */
min-height: 100vh;
}
/* Documentation Tree Styles */
#docs-tree {
/* Scrollable area for the documentation tree */
max-height: calc(100vh - 64px); /* Full height minus header height */
overflow-y: auto;
border-right: 1px solid #282828;
padding-right: 1rem;
/* Hide scrollbar for aesthetics */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
#docs-tree::-webkit-scrollbar {
display: none; /* Chrome, Safari, Opera */
}
.tree-nav, .tree-nav ul {
list-style: none;
padding-left: 1rem;
margin: 0;
}
.tree-nav li {
margin: 0.25rem 0;
}
.folder, .file {
display: block;
cursor: pointer;
padding: 0.3rem 0.5rem;
border-radius: 0.375rem; /* rounded-md */
transition: all 0.1s ease-in-out;
font-size: 0.9rem;
user-select: none;
word-break: break-word;
}
.folder {
font-weight: 500;
color: #e0e0e0;
}
.folder:hover {
background-color: #1a1a1a;
}
.folder::before {
content: '📁 ';
margin-right: 0.5rem;
transition: transform 0.2s;
}
.folder.expanded::before {
content: '📂 ';
}
.file {
font-weight: 400;
color: #a0a0a0;
}
.file:hover {
background-color: #1a1a1a;
color: #FAF9F6;
}
/* Highlight color: #feb208 */
.file.active {
background-color: #feb208;
color: #101010; /* Dark text on bright background */
font-weight: 600;
}
/* Markdown Content Styling */
.markdown-content {
padding: 1rem;
}
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
font-weight: 600;
margin-top: 1.5rem;
margin-bottom: 0.75rem;
}
.markdown-content h1 { font-size: 1.875rem; color: #FAF9F6; }
.markdown-content h2 { font-size: 1.5rem; border-bottom: 1px solid #333; padding-bottom: 0.25rem; }
.markdown-content p, .markdown-content li {
line-height: 1.6;
margin-bottom: 1rem;
color: #ccc;
}
.markdown-content a {
color: #feb208;
text-decoration: none;
transition: color 0.2s;
}
.markdown-content a:hover {
text-decoration: underline;
}
.markdown-content pre {
background-color: #030303;
padding: 1rem;
border-radius: 0.5rem;
overflow-x: auto;
margin-bottom: 1.5rem;
border: 1px solid #333;
}
.markdown-content blockquote {
border-left: 4px solid #feb208;
padding-left: 1rem;
margin: 1rem 0;
color: #aaa;
background-color: #1a1a1a;
padding: 0.75rem;
border-radius: 0.25rem;
}
/* Table Styles */
.markdown-content table {
width: 100%;
border-collapse: collapse;
margin: 1.5rem 0;
background-color: #1a1a1a;
border-radius: 0.5rem;
overflow: hidden;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.markdown-content thead {
background-color: #030303;
border-bottom: 2px solid #feb208;
}
.markdown-content th {
padding: 0.75rem 1rem;
text-align: left;
font-weight: 600;
color: #feb208;
font-size: 0.9rem;
text-transform: uppercase;
letter-spacing: 0.05em;
border-right: 1px solid #282828;
}
.markdown-content th:last-child {
border-right: none;
}
.markdown-content td {
padding: 0.75rem 1rem;
border-bottom: 1px solid #282828;
border-right: 1px solid #282828;
color: #e0e0e0;
font-size: 0.9rem;
line-height: 1.5;
}
.markdown-content td:last-child {
border-right: none;
}
.markdown-content tbody tr {
transition: all 0.2s ease-in-out;
}
.markdown-content tbody tr:hover {
background-color: #252525;
}
.markdown-content tbody tr:last-child td {
border-bottom: none;
}
/* Striped rows variant */
.markdown-content table.striped tbody tr:nth-child(even) {
background-color: #202020;
}
.markdown-content table.striped tbody tr:nth-child(even):hover {
background-color: #2a2a2a;
}
/* Compact table variant */
.markdown-content table.compact th,
.markdown-content table.compact td {
padding: 0.5rem 0.75rem;
font-size: 0.85rem;
}
/* Bordered table variant */
.markdown-content table.bordered {
border: 1px solid #282828;
}
.markdown-content table.bordered th,
.markdown-content table.bordered td {
border: 1px solid #282828;
}
/* Responsive table */
.table-container {
overflow-x: auto;
margin: 1.5rem 0;
border-radius: 0.5rem;
}
.table-container table {
margin: 0;
min-width: 600px;
}
/* Code in tables */
.markdown-content table code {
background-color: #030303;
padding: 0.2rem 0.4rem;
border-radius: 0.25rem;
font-size: 0.85rem;
color: #feb208;
border: 1px solid #333;
}
.markdown-content table a {
color: #feb208;
text-decoration: none;
transition: color 0.2s;
}
.markdown-content table a:hover {
text-decoration: underline;
color: #ffc107;
}
/* Table captions */
.markdown-content table caption {
caption-side: bottom;
font-size: 0.8rem;
color: #a0a0a0;
text-align: center;
padding: 0.5rem;
margin-top: 0.5rem;
}
</style>
</head>
<body class="min-h-screen">
<nav class="bg-[#030303] p-4 sticky top-0 z-50 shadow-lg">
<div class="container mx-auto flex justify-between items-center">
<a href="#" class="text-2xl bg-gradient-to-r from-[#FFFFFF] to-[#f2f2f2] bg-clip-text text-transparent">
Novaria
</a>
<div id="nav-links" class="hidden md:flex space-x-4">
<a href="index.html" class="text-gray-300 hover:text-white px-3 py-2 font-medium transition-all">Home</a>
<a href="docs.html" class="text-gray-300 hover:text-white px-3 py-2 font-medium transition-all">Docs</a>
<a href="index.html/#roadmap"
class="text-gray-300 hover:text-white px-3 py-2 font-medium transition-all">Roadmap</a>
<a href="https://t.me/novariaos" class="text-white px-3 py-2">Telegram</a>
</div>
</div>
</nav>
<!-- Main Docs Layout (Two-Pane) -->
<main class="docs-layout flex flex-col md:flex-row max-w-7xl mx-auto">
<!-- Documentation Tree Sidebar -->
<div id="docs-tree" class="w-full md:w-72 lg:w-80 flex-shrink-0 p-4 bg-[#141414] md:bg-transparent shadow-xl md:shadow-none">
<h2 class="text-xl font-semibold mb-3 border-b border-[#282828] pb-2 text-[#feb208]">Documentation Tree</h2>
<div class="content-placeholder text-center py-8">
<div>📁</div>
<p class="text-gray-400">Loading documentation...</p>
</div>
</div>
<!-- Documentation Content Area -->
<div id="docs-content" class="flex-grow p-4 sm:p-6 lg:p-8">
<div class="content-placeholder text-center py-16">
<h3 class="text-2xl font-bold mb-2">Welcome to NovariaOS Documentation</h3>
<p class="text-gray-400">Select a topic from the navigation tree to get started.</p>
</div>
</div>
</main>
<div class="container mx-auto">
<span class="block text-sm mt-10 text-body sm:text-center">© 2023-2026 <a href="https://t.me/NovariaOS" class="hover:underline">Novaria</a>. <span class="text-[#feb208]">Source code is available</span>.
</div>
<!-- JavaScript for GitHub API interaction and Markdown rendering -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
// Constants for GitHub repository
const repoOwner = 'novariaos';
const repoName = 'novariaos-src';
const baseUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contents/docs/`;
const rawUrlPrefix = `https://raw.githubusercontent.com/${repoOwner}/${repoName}/main/docs/`;
const contentCache = new Map();
// Utility for fetching repository contents (directories/files)
async function fetchRepoContents(path = '') {
try {
// Using the full path in the URL to correctly navigate subdirectories
const response = await fetch(baseUrl + path, {
headers: {
// Accept specific media type for file/directory structure
'Accept': 'application/vnd.github.v3.json'
}
});
if (!response.ok) {
// Fallback for API limits/errors
throw new Error('Failed to fetch contents from GitHub API. Rate limit or repository error.');
}
const contents = await response.json();
// Filter out non-directory/non-markdown files and sort
return contents
.filter(item => item.type === 'dir' || (item.type === 'file' && item.name.endsWith('.md')))
.sort((a, b) => {
// Directories first, then alphabetical
if (a.type === 'dir' && b.type !== 'dir') return -1;
if (a.type !== 'dir' && b.type === 'dir') return 1;
return a.name.localeCompare(b.name);
});
} catch (error) {
console.error('Error fetching repo contents:', error);
document.getElementById('docs-tree').innerHTML =
'<p class="text-red-500 p-4">Error loading documentation tree. Check console for details.</p>';
return [];
}
}
// Utility for fetching file content (Markdown)
async function fetchFileContent(path) {
if (contentCache.has(path)) {
return contentCache.get(path);
}
try {
const response = await fetch(rawUrlPrefix + path);
if (!response.ok) throw new Error('Failed to fetch file content.');
const content = await response.text();
contentCache.set(path, content);
return content;
} catch (error) {
console.error('Error fetching file content:', error);
return '# Error\n\nUnable to load the requested documentation content.';
}
}
async function preloadAllContent(path = '') {
const contents = await fetchRepoContents(path);
const preloadPromises = [];
for (const item of contents) {
const relativePath = item.path.replace('docs/', '');
if (item.type === 'dir') {
preloadPromises.push(preloadAllContent(relativePath));
} else if (item.type === 'file' && item.name.endsWith('.md')) {
preloadPromises.push(
fetchFileContent(relativePath).then(content => {
return { path: relativePath, content };
})
);
}
}
const results = await Promise.allSettled(preloadPromises);
const loadedContents = [];
results.forEach(result => {
if (result.status === 'fulfilled') {
if (Array.isArray(result.value)) {
loadedContents.push(...result.value);
} else if (result.value && result.value.path) {
loadedContents.push(result.value);
}
}
});
return loadedContents;
}
// Main function to render the documentation navigation tree
async function renderDocsTree(path = '', parentElement = document.getElementById('docs-tree'), level = 0) {
const contents = await fetchRepoContents(path);
// Clear loading placeholder on first call (level 0)
if (level === 0) {
parentElement.innerHTML = '<h2 class="text-xl font-semibold mb-3 border-b border-[#282828] pb-2 text-[#feb208]">Documentation Tree</h2>';
}
const ul = document.createElement('ul');
ul.className = 'tree-nav';
if (level > 0) {
// For sub-directories, we append to a container, not directly to the parent
parentElement.appendChild(ul);
} else {
parentElement.appendChild(ul);
}
let firstMarkdownFile = null;
for (const item of contents) {
const relativePath = item.path.replace('docs/', ''); // Path relative to /docs/
if (item.type === 'dir') {
const li = document.createElement('li');
// Folder title and icon
const folderSpan = document.createElement('span');
folderSpan.className = 'folder';
// Clean up folder name for display
folderSpan.textContent = item.name.replace(/-/g, ' ');
li.appendChild(folderSpan);
// Container for children, initially hidden
const childContainer = document.createElement('div');
childContainer.style.display = 'none';
// Recursive call to render children
await renderDocsTree(relativePath, childContainer, level + 1);
li.appendChild(childContainer);
ul.appendChild(li);
// Add click event to toggle folder
folderSpan.addEventListener('click', function() {
this.classList.toggle('expanded');
childContainer.style.display = childContainer.style.display === 'none' ? 'block' : 'none';
});
// Auto-expand first level (optional, but good for main categories)
if (level === 0) {
folderSpan.classList.add('expanded');
childContainer.style.display = 'block';
}
} else if (item.type === 'file' && item.name.endsWith('.md')) {
if (!firstMarkdownFile) {
firstMarkdownFile = item;
}
const li = document.createElement('li');
const a = document.createElement('a');
a.href = '#';
a.className = 'file';
// Clean up file name for display
a.textContent = item.name.replace(/-/g, ' ').replace('.md', '');
if (contentCache.has(relativePath)) {
a.classList.add('preloaded');
}
// Click handler for loading content
a.onclick = async (e) => {
e.preventDefault();
// Update active states
document.querySelectorAll('.file.active').forEach(el => {
el.classList.remove('active');
});
a.classList.add('active');
const docsContent = document.getElementById('docs-content');
if (contentCache.has(relativePath)) {
docsContent.innerHTML =
'<div class="markdown-content">' + marked.parse(contentCache.get(relativePath)) + '</div>';
docsContent.innerHTML = '<div class="content-placeholder text-center py-16"><div class="animate-spin h-8 w-8 border-4 border-[#feb208] border-t-transparent rounded-full mx-auto mb-4"></div><p class="text-gray-400">Loading...</p></div>';
// Load and render content
const markdown = await fetchFileContent(relativePath);
docsContent.innerHTML =
'<div class="markdown-content">' + marked.parse(markdown) + '</div>';
}
// Scroll to the top of the content
docsContent.scrollTop = 0;
};
li.appendChild(a);
ul.appendChild(li);
}
}
// Load the first markdown file in the tree (only on the initial call)
if (firstMarkdownFile && level === 0) {
// Wait for a brief moment to ensure the tree is rendered before clicking
setTimeout(() => {
const firstFileLink = ul.querySelector('.file');
if (firstFileLink) {
firstFileLink.click();
} else {
document.getElementById('docs-content').innerHTML =
'<div class="markdown-content text-center py-16"># No Documentation Found</div>';
}
}, 50);
}
}
// Initialize the documentation tree with preloading
document.addEventListener('DOMContentLoaded', async () => {
const docsContent = document.getElementById('docs-content');
docsContent.innerHTML = '<div class="content-placeholder text-center py-16"><div class="animate-spin h-8 w-8 border-4 border-[#feb208] border-t-transparent rounded-full mx-auto mb-4"></div><p class="text-gray-400">Preloading all documentation...</p></div>';
await Promise.all([
renderDocsTree(),
preloadAllContent()
]);
console.log(`Preloaded ${contentCache.size} documentation files`);
if (docsContent.querySelector('.content-placeholder')) {
const firstFileLink = document.querySelector('.file');
if (firstFileLink) {
firstFileLink.click();
}
}
});
</script>
</body>
</html>