forked from webstudio-ltd/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
1241 lines (1104 loc) · 54.9 KB
/
Copy pathindex.php
File metadata and controls
1241 lines (1104 loc) · 54.9 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
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
require __DIR__ . '/access_guard.php';
/**
* Server-side OG meta tags for social media crawlers.
* Calculates og:title, og:description, og:image for the requested page.
*/
$_ogData = (function() {
$dataDir = __DIR__ . '/data';
$pagesDir = __DIR__ . '/data/pages';
$ogImgDir = __DIR__ . '/images/og';
$fontDir = __DIR__ . '/data/.fonts';
$pageId = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['page'] ?? '');
$readJson = function($path) {
if (!file_exists($path)) return null;
$raw = file_get_contents($path);
return $raw ? json_decode($raw, true) : null;
};
$settings = $readJson($dataDir . '/settings.json') ?? [];
$siteName = $settings['siteName'] ?? 'Docs';
$accent = $settings['accentColor'] ?? '#f97316';
$page = null;
if ($pageId) {
$page = $readJson($pagesDir . "/{$pageId}.json");
}
// Fallback: first page of first space
if (!$page) {
$spaces = $readJson($dataDir . '/spaces.json') ?? [];
if (!empty($spaces)) {
$sid = $spaces[0]['id'] ?? '';
foreach (glob($pagesDir . '/*.json') ?: [] as $f) {
$p = $readJson($f);
if ($p && ($p['spaceId'] ?? '') === $sid && empty($p['parentId'])) {
if (!$page || ($p['order'] ?? 0) < ($page['order'] ?? 0)) $page = $p;
}
}
}
}
$title = $page ? ($page['title'] ?? 'Docs') : $siteName;
$desc = $page && !empty($page['subtitle']) ? $page['subtitle'] : "{$siteName} documentation";
$imgUrl = '';
// Cover image? (type=image only, not color)
if ($page && !empty($page['cover']) && ($page['cover']['type'] ?? '') === 'image') {
$imgUrl = $page['cover']['value'] ?? '';
if ($imgUrl && !preg_match('#^https?://#', $imgUrl)) {
$proto = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$base = rtrim(dirname($_SERVER['PHP_SELF']), '/');
$imgUrl = "{$proto}://{$host}{$base}/{$imgUrl}";
}
}
// Generate OG image if no cover image
if (!$imgUrl && $page && function_exists('imagecreatetruecolor')) {
if (!is_dir($ogImgDir)) @mkdir($ogImgDir, 0755, true);
// Include cover color in hash so it regenerates if cover changes
$coverVal = $page['cover']['value'] ?? '';
$hash = md5($pageId . $title . ($page['subtitle'] ?? '') . $accent . $coverVal . $siteName);
$cache = $ogImgDir . "/{$hash}.png";
if (!file_exists($cache)) {
$w = 1200; $h = 630;
$img = imagecreatetruecolor($w, $h);
$hasCoverColor = !empty($page['cover']) && ($page['cover']['type'] ?? '') === 'color';
if ($hasCoverColor) {
$val = $page['cover']['value'] ?? '';
$colors = [];
if (preg_match_all('/#([0-9a-fA-F]{6})/', $val, $m)) $colors = $m[0];
if (count($colors) >= 2) { $c1 = $colors[0]; $c2 = $colors[1]; }
else { $c1 = $accent; $c2 = $accent; }
$r1 = hexdec(substr($c1,1,2)); $g1 = hexdec(substr($c1,3,2)); $b1 = hexdec(substr($c1,5,2));
$r2 = hexdec(substr($c2,1,2)); $g2 = hexdec(substr($c2,3,2)); $b2 = hexdec(substr($c2,5,2));
} else {
$r1 = hexdec(substr($accent,1,2)); $g1 = hexdec(substr($accent,3,2)); $b1 = hexdec(substr($accent,5,2));
$r2 = max(0,$r1-50); $g2 = max(0,$g1-50); $b2 = max(0,$b1-30);
}
for ($x = 0; $x < $w; $x++) {
$ratio = $x / $w;
$cr = (int)($r1 + ($r2-$r1) * $ratio);
$cg = (int)($g1 + ($g2-$g1) * $ratio);
$cb = (int)($b1 + ($b2-$b1) * $ratio);
$color = imagecolorallocate($img, max(0,min(255,$cr)), max(0,min(255,$cg)), max(0,min(255,$cb)));
imageline($img, $x, 0, $x, $h, $color);
}
$white = imagecolorallocate($img, 255, 255, 255);
$whiteA70 = imagecolorallocatealpha($img, 255, 255, 255, 38);
if (!is_dir($fontDir)) @mkdir($fontDir, 0755, true);
$fontBold = $fontDir . '/Inter-Bold.ttf';
$fontRegular = $fontDir . '/Inter-Regular.ttf';
if (!file_exists($fontBold))
@file_put_contents($fontBold, @file_get_contents('https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuFuYMZhrib2Bg-4.ttf'));
if (!file_exists($fontRegular))
@file_put_contents($fontRegular, @file_get_contents('https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfMZhrib2Bg-4.ttf'));
$useTTF = file_exists($fontBold) && filesize($fontBold) > 1000;
if ($useTTF) {
$snBbox = imagettfbbox(17, 0, $fontRegular, $siteName);
$snWidth = $snBbox ? ($snBbox[2] - $snBbox[0]) : 100;
imagettftext($img, 17, 0, $w - $snWidth - 60, 48, $whiteA70, $fontRegular, $siteName);
$fontSize = 52;
$titleText = $page['title'] ?? 'Docs';
$words = explode(' ', $titleText);
$lines = []; $line = '';
foreach ($words as $word) {
$test = $line ? "{$line} {$word}" : $word;
$bbox = imagettfbbox($fontSize, 0, $fontBold, $test);
if ($bbox && ($bbox[2] - $bbox[0]) > 1040) { if ($line) $lines[] = $line; $line = $word; }
else $line = $test;
}
if ($line) $lines[] = $line;
$lines = array_slice($lines, 0, 3);
$hasSubtitle = !empty($page['subtitle']);
$titleY = $hasSubtitle ? 300 : 350;
$lineHeight = (int)($fontSize * 1.35);
foreach ($lines as $i => $l)
imagettftext($img, $fontSize, 0, 80, $titleY + $i * $lineHeight, $white, $fontBold, $l);
if ($hasSubtitle)
imagettftext($img, 23, 0, 80, $titleY + count($lines) * $lineHeight + 20, $whiteA70, $fontRegular, mb_substr($page['subtitle'], 0, 90));
} else {
imagestring($img, 5, 80, 300, $page['title'] ?? 'Docs', $white);
if (!empty($page['subtitle'])) imagestring($img, 4, 80, 340, substr($page['subtitle'], 0, 80), $whiteA70);
imagestring($img, 3, $w - 200, 30, $siteName, $whiteA70);
}
imagepng($img, $cache, 0);
}
if (file_exists($cache)) {
$proto = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$base = rtrim(dirname($_SERVER['PHP_SELF']), '/');
$imgUrl = "{$proto}://{$host}{$base}/images/og/" . basename($cache);
}
}
$proto = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$basePath = rtrim(dirname($_SERVER['PHP_SELF']), '/');
$url = "{$proto}://{$host}{$basePath}/" . ($pageId ? "?page={$pageId}" : '');
return [
'title' => htmlspecialchars($title, ENT_QUOTES),
'desc' => htmlspecialchars($desc, ENT_QUOTES),
'siteName' => htmlspecialchars($siteName, ENT_QUOTES),
'image' => htmlspecialchars($imgUrl, ENT_QUOTES),
'url' => htmlspecialchars($url, ENT_QUOTES),
'fullTitle'=> htmlspecialchars($page ? "{$title} — {$siteName}" : $siteName, ENT_QUOTES),
];
})();
?>
<!DOCTYPE html>
<!--
╔══════════════════════════════════════════════════════════╗
║ Webstudio Docs ║
║ Open-source self-hosted documentation platform ║
║ Built with ♥ by webstudio.ltd ║
║ https://github.com/webstudio-ltd/docs ║
║ ║
║ Free to use. If this saves you money on GitBook, ║
║ consider giving us a ⭐ on GitHub. ║
╚══════════════════════════════════════════════════════════╝
-->
<html lang="de" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Webstudio Docs — webstudio.ltd">
<meta name="description" content="<?= $_ogData['desc'] ?>">
<meta name="robots" content="index, follow">
<meta property="og:type" content="website">
<meta property="og:url" content="<?= $_ogData['url'] ?>">
<meta property="og:title" content="<?= $_ogData['title'] ?>" id="og-title">
<meta property="og:description" content="<?= $_ogData['desc'] ?>" id="og-desc">
<meta property="og:site_name" content="<?= $_ogData['siteName'] ?>" id="og-site">
<meta property="og:image" content="<?= $_ogData['image'] ?>" id="og-image">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="<?= $_ogData['title'] ?>">
<meta name="twitter:description" content="<?= $_ogData['desc'] ?>">
<meta name="twitter:image" content="<?= $_ogData['image'] ?>">
<link rel="canonical" href="<?= $_ogData['url'] ?>">
<link rel="icon" id="dynamic-favicon" href="data:,">
<title id="doc-title"><?= $_ogData['fullTitle'] ?></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" id="prism-theme">
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/app.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js" defer></script>
<script src="assets/i18n.js"></script>
<script src="assets/shared.js"></script>
</head>
<body>
<!-- Google Translate init element — musí byť v DOM, schovaný offscreen -->
<div id="google_translate_element"></div>
<div class="mobile-sidebar-overlay" id="mobile-sidebar-overlay" onclick="toggleMobileSidebar()"></div>
<!-- TOP NAV — header row -->
<nav class="topnav">
<button class="icon-btn mobile-menu-btn" id="mobile-menu-btn" onclick="toggleMobileSidebar()">
<i class="fa-solid fa-bars"></i>
</button>
<div class="logo-area" id="logo-area-btn">
<div class="logo-img" id="logo-display">
<i class="fa-solid fa-book-open"></i>
</div>
<span class="logo-name" id="logo-name-display">My Docs</span>
</div>
<div class="search-wrap">
<div class="search-box">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="text" data-i18n-ph="searchPlaceholder" placeholder="Search..." id="search-input"
oninput="handleSearch(this.value)"
onfocus="openSearchDD()"
onblur="setTimeout(closeSearchDD, 200)">
<span class="search-kbd">⌘K</span>
</div>
<div class="search-dropdown" id="search-dd"></div>
</div>
<div class="nav-right">
<button class="icon-btn" onclick="toggleReadingMode()" id="reading-mode-btn" data-i18n-attr="title" data-i18n="btnReadingMode" title="Reading mode (focus)">
<i class="fa-solid fa-book-open-reader"></i>
</button>
<button class="icon-btn" onclick="toggleTheme()" id="theme-btn" data-i18n-attr="title" data-i18n="btnToggleTheme" title="Toggle theme">
<i class="fa-solid fa-moon"></i>
</button>
<!-- Translate -->
<div class="translate-wrap" id="translate-wrap">
<button class="icon-btn" onclick="toggleTranslate()" id="translate-btn" data-i18n-attr="title" data-i18n="btnTranslate" title="Translate page">
<i class="fa-solid fa-language"></i>
</button>
<div class="translate-dropdown" id="translate-dd">
<div class="translate-lang active" id="translate-origin-item" data-lang="origin" onclick="translateTo(S.settings.lang||'de')"><span class="flag" id="translate-origin-flag">🇩🇪</span> <span id="translate-origin-label">Deutsch (original)</span></div>
<div class="translate-sep"></div>
<div class="translate-lang" data-lang="en" onclick="translateTo('en')"><span class="flag">🇬🇧</span> English</div>
<div class="translate-lang" data-lang="cs" onclick="translateTo('cs')"><span class="flag">🇨🇿</span> Čeština</div>
<div class="translate-lang" data-lang="de" onclick="translateTo('de')"><span class="flag">🇩🇪</span> Deutsch</div>
<div class="translate-lang" data-lang="fr" onclick="translateTo('fr')"><span class="flag">🇫🇷</span> Français</div>
<div class="translate-lang" data-lang="es" onclick="translateTo('es')"><span class="flag">🇪🇸</span> Español</div>
<div class="translate-lang" data-lang="pl" onclick="translateTo('pl')"><span class="flag">🇵🇱</span> Polski</div>
<div class="translate-lang" data-lang="uk" onclick="translateTo('uk')"><span class="flag">🇺🇦</span> Українська</div>
<div class="translate-lang" data-lang="ru" onclick="translateTo('ru')"><span class="flag">🇷🇺</span> Русский</div>
</div>
</div>
</div>
</nav>
<!-- TAB BAR — second row, full width (GitBook style) -->
<div class="tabbar" id="tabbar">
<div class="tab-strip" id="tab-strip"></div>
</div>
<!-- LAYOUT -->
<div class="layout">
<!-- SIDEBAR -->
<aside class="sidebar" id="sidebar">
<!-- Nav tree -->
<div class="sidebar-body" id="nav-tree"></div>
<div class="sidebar-footer" id="sidebar-footer">
<i class="fa-solid fa-bolt" id="footer-icon"></i>
<span id="footer-text-display"></span>
<span id="footer-tail-display" class="footer-tail-display"></span>
</div>
</aside>
<!-- MAIN -->
<main class="main">
<div class="content-wrap" id="content-wrap">
<div id="page-view"></div>
</div>
<div class="toc-panel" id="toc-panel">
<div class="toc-head" data-i18n="tocTitle">On this page</div>
<div id="toc-items"></div>
<div id="toc-feedback-box">
<div class="toc-sep"></div>
<div class="toc-feedback-label" data-i18n="tocFeedback">Was this helpful?</div>
<div class="toc-feedback-btns">
<button class="fb-btn" type="button" data-rating="-1" data-icon="👎" onclick="react(this.dataset.rating, this.dataset.icon)" data-i18n-attr="title" data-i18n="ratingNegative" title="Not helpful"><i class="fa-regular fa-face-frown"></i></button>
<button class="fb-btn" type="button" data-rating="0" data-icon="😐" onclick="react(this.dataset.rating, this.dataset.icon)" data-i18n-attr="title" data-i18n="ratingNeutral" title="Neutral"><i class="fa-regular fa-face-meh"></i></button>
<button class="fb-btn" type="button" data-rating="1" data-icon="👍" onclick="react(this.dataset.rating, this.dataset.icon)" data-i18n-attr="title" data-i18n="ratingPositive" title="Helpful"><i class="fa-regular fa-face-smile"></i></button>
</div>
</div>
<div id="toc-admin-rating-slot"></div>
<div id="toc-share-section">
<div class="toc-sep"></div>
<div class="toc-share-box">
<div class="toc-feedback-label" data-i18n="tocShare">Share</div>
<button class="toc-share-btn" onclick="sharePage()">
<i class="fa-solid fa-link"></i>
<span id="toc-share-label" data-i18n="tocShare">Share</span>
</button>
</div>
</div>
</div>
</main>
</div>
<!-- Scroll to top button -->
<button class="scroll-top-btn" id="scroll-top-btn" onclick="window.scrollTo({top:0,behavior:'smooth'})">
<i class="fa-solid fa-arrow-up"></i>
</button>
<!-- Hover preview -->
<div class="nav-hover-preview" id="nav-hover-preview">
<div id="nhp-cover" style="height:80px;border-radius:7px;margin-bottom:10px;background-size:cover;background-position:center;display:none;overflow:hidden;"></div>
<div class="nav-hover-preview-title" id="nhp-title"></div>
<div class="nav-hover-preview-desc" id="nhp-desc"></div>
</div>
<!-- Shortcuts overlay -->
<div class="shortcuts-overlay" id="shortcuts-overlay" onclick="closeShortcuts()">
<div class="shortcuts-panel" onclick="event.stopPropagation()">
<h3><i class="fa-solid fa-keyboard" style="margin-right:8px;color:var(--accent)"></i><span data-i18n="shortcutShortcuts">Shortcuts</span></h3>
<div class="shortcut-row"><span class="shortcut-label" data-i18n="shortcutSearch">Search</span><span class="shortcut-keys"><kbd>⌘</kbd><kbd>K</kbd></span></div>
<div class="shortcut-row"><span class="shortcut-label" data-i18n="shortcutReadingMode">Reading mode</span><span class="shortcut-keys"><kbd>⌘</kbd><kbd>R</kbd></span></div>
<div class="shortcut-row" id="shortcut-share-row"><span class="shortcut-label" data-i18n="shortcutShare">Share page</span><span class="shortcut-keys"><kbd>⌘</kbd><kbd>⇧</kbd><kbd>C</kbd></span></div>
<div class="shortcut-row"><span class="shortcut-label" data-i18n="shortcutPrevNext">Previous / Next page</span><span class="shortcut-keys"><kbd>←</kbd><kbd>→</kbd></span></div>
<div class="shortcut-row"><span class="shortcut-label" data-i18n="shortcutShortcuts">Shortcuts</span><span class="shortcut-keys"><kbd>?</kbd></span></div>
<div class="shortcut-row"><span class="shortcut-label">Esc</span><span class="shortcut-keys"><kbd>Esc</kbd></span></div>
</div>
</div>
<!-- Toast -->
<div class="toast" id="toast">
<div class="toast-dot"></div>
<span id="toast-text">Saved</span>
</div>
<!-- ════ SCRIPTS ════ -->
<script>
// ════════════════════════════════════════════════════════════
// Webstudio Docs — read-only public viewer
// Renders saved page content WITHOUT EditorJS.
// TRANSLATIONS / DEFAULT_INTERFACE_LANG / LANG_LOCALES / ICON_LIST
// are provided by assets/i18n.js.
// ════════════════════════════════════════════════════════════
// ── Viewer-only style supplements (replace CSS the EditorJS tools used to inject) ──
(function () {
const css = `
.ce-code .viewer-code{margin:0;padding:14px 44px 14px 16px;overflow:auto;background:transparent !important;font-family:var(--mono);font-size:13px;line-height:1.6;text-shadow:none !important;}
.ce-code .viewer-code code{background:transparent !important;font-family:var(--mono);font-size:13px;line-height:1.6;text-shadow:none !important;white-space:pre;}
[data-theme="dark"] .ce-code .viewer-code code:not([class*="language-"]){color:#7dd3fc;}
[data-theme="light"] .ce-code .viewer-code code:not([class*="language-"]){color:#0f4c81;}
.tc-table{border-collapse:collapse;width:100%;}
.tc-cell{border:1px solid var(--border);padding:8px 12px;text-align:left;vertical-align:top;}
.tc-table th.tc-cell{background:var(--bg3);font-weight:600;}
.page-hero .page-icon{cursor:default;}
.page-title-input{margin:0;}
`;
const st = document.createElement('style');
st.textContent = css;
document.head.appendChild(st);
})();
// ════════════════════════════════════════
// STATE
// ════════════════════════════════════════
let S = {
pages: [],
spaces: [],
currentSpaceId: null,
currentPageId: null,
authed: false,
settings: {
siteName: 'My Docs',
accentColor: DEFAULT_ACCENT,
theme: 'dark',
footerText: DEFAULT_FOOTER_TEXT_HTML,
footerTailHtml: DEFAULT_FOOTER_TAIL_HTML,
logoDataUrl: null,
faviconDataUrl: null,
tabTitle: 'Docs',
lang: DEFAULT_INTERFACE_LANG,
hideSingleSpaceTabs: false,
shareSectionEnabled: true,
translateEnabled: true,
}
};
// scrollSpyObserver is declared in assets/shared.js
let feedbackSaving = false;
// FEEDBACK_STORAGE_KEY is in assets/shared.js
const THEME_STORAGE_KEY = 'ws_docs_theme';
const ACCESS_TOKEN_QUERY_PARAM = 'token';
const ACCESS_TOKEN_STORAGE_KEY = 'ws_docs_access_token';
let accessTokenCache = '';
function getAccessTokenFromUrl() {
const params = new URLSearchParams(window.location.search);
return params.get(ACCESS_TOKEN_QUERY_PARAM) || '';
}
function readStoredAccessToken() {
try {
return sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY) || '';
} catch (e) {
return '';
}
}
function writeStoredAccessToken(token) {
accessTokenCache = token || '';
try {
if (accessTokenCache) sessionStorage.setItem(ACCESS_TOKEN_STORAGE_KEY, accessTokenCache);
else sessionStorage.removeItem(ACCESS_TOKEN_STORAGE_KEY);
} catch (e) {}
}
function getActiveAccessToken() {
if (accessTokenCache) return accessTokenCache;
const urlToken = getAccessTokenFromUrl();
if (urlToken) {
writeStoredAccessToken(urlToken);
return urlToken;
}
const storedToken = readStoredAccessToken();
if (storedToken) {
accessTokenCache = storedToken;
return storedToken;
}
return '';
}
function buildViewerUrl(pageId = '', options = {}) {
const { includeAccessToken = false } = options;
const url = new URL(window.location.pathname, window.location.origin);
if (pageId) url.searchParams.set('page', pageId);
if (includeAccessToken) {
const accessToken = getActiveAccessToken();
if (accessToken) url.searchParams.set(ACCESS_TOKEN_QUERY_PARAM, accessToken);
}
return url.pathname + url.search + url.hash;
}
function buildPageHref(pageId = '') {
return buildViewerUrl(pageId);
}
// isPrimaryNavigationClick is in assets/shared.js
function internalPageIdFromLink(link) {
let id = link.dataset.pageId || '';
if (!id) {
const href = link.getAttribute('href') || '';
const m = href.match(/^\?page=([^&#]*)/);
if (m) { try { id = decodeURIComponent(m[1]); } catch (e) { id = m[1]; } }
}
return id.replace(/[^A-Za-z0-9_-]/g, '');
}
function bindViewerPageLinks(root = document) {
root.querySelectorAll('a[data-page-id], a[href^="?page="]').forEach(link => {
if (link.dataset.navBound === '1') return;
const pageId = internalPageIdFromLink(link);
if (!pageId) return;
link.dataset.navBound = '1';
link.addEventListener('click', event => {
if (!isPrimaryNavigationClick(event)) return;
event.preventDefault();
const targetSpaceId = link.dataset.spaceId || '';
const shouldCloseSearch = link.dataset.closeSearch === '1';
if (shouldCloseSearch) {
const searchInput = document.getElementById('search-input');
if (searchInput) searchInput.value = '';
closeSearchDD();
}
if (targetSpaceId && targetSpaceId !== S.currentSpaceId) {
S.currentSpaceId = targetSpaceId;
renderSpaces();
}
navigateTo(pageId);
});
});
}
// Alias so the shared updatePageNavBottom() helper in assets/shared.js
// can call the viewer's link binder without knowing its specific name.
const bindPageLinks = bindViewerPageLinks;
function stripAccessTokenFromCurrentUrl() {
if (!getAccessTokenFromUrl()) return;
history.replaceState(history.state, '', buildViewerUrl(new URLSearchParams(window.location.search).get('page') || ''));
}
function restoreAccessTokenInUrlForReload() {
const accessToken = getActiveAccessToken();
if (!accessToken) return;
const pageId = new URLSearchParams(window.location.search).get('page') || '';
history.replaceState(history.state, '', buildViewerUrl(pageId, { includeAccessToken: true }));
}
function withAccessToken(url) {
const accessToken = getActiveAccessToken();
if (!accessToken) return url;
const resolvedUrl = new URL(url, window.location.href);
if (!resolvedUrl.searchParams.has(ACCESS_TOKEN_QUERY_PARAM)) {
resolvedUrl.searchParams.set(ACCESS_TOKEN_QUERY_PARAM, accessToken);
}
return resolvedUrl.pathname + resolvedUrl.search + resolvedUrl.hash;
}
writeStoredAccessToken(getAccessTokenFromUrl() || readStoredAccessToken());
stripAccessTokenFromCurrentUrl();
window.addEventListener('beforeunload', restoreAccessTokenInUrlForReload);
// ════════════════════════════════════════
// DATA — server JSON (api.php, read-only)
// ════════════════════════════════════════
async function load() {
try {
const r = await fetch(withAccessToken('api.php?action=load'), { credentials: 'same-origin' });
const d = await r.json();
if (!d.ok) throw new Error(d.error);
S.spaces = d.spaces || [];
S.settings = { ...S.settings, ...(d.settings || {}) };
S.pages = (d.pages || []).map(p => ({ ...p, _contentLoaded: !!p.content?.blocks }));
// Migrate old list format (string items → { content, items })
S.pages.forEach(p => {
if (p.content?.blocks) {
p.content.blocks.forEach(b => {
if (b.type === 'list' && Array.isArray(b.data?.items)) {
b.data.items = b.data.items.map(i => typeof i === 'string' ? { content: i, items: [] } : i);
}
});
}
});
} catch (e) {
console.warn('Load error:', e);
}
}
async function loadPageContent(pageId) {
const page = S.pages.find(p => p.id === pageId);
if (!page || page._contentLoaded) return page;
try {
const r = await fetch(withAccessToken(`api.php?action=load_page&id=${encodeURIComponent(pageId)}`), { credentials: 'same-origin' });
const d = await r.json();
if (d.ok && d.page) {
Object.assign(page, d.page);
page._contentLoaded = true;
}
} catch (e) {}
return page;
}
// ════════════════════════════════════════
// UTILITIES (shared helpers in assets/shared.js: esc, sanitizeFooterHtml,
// footerHasText, applyFooterDisplay, showToast, formatDate, slugify,
// highlight, getBlockSearchText, getPageTextSnippet, detectCodeLanguage)
// ════════════════════════════════════════
// ════════════════════════════════════════
// SETTINGS / THEME
// ════════════════════════════════════════
function applySettings() {
const s = S.settings;
document.documentElement.dataset.theme = s.theme;
document.documentElement.lang = s.lang || DEFAULT_INTERFACE_LANG;
const themeBtn = document.getElementById('theme-btn');
if (themeBtn) themeBtn.innerHTML = s.theme === 'dark'
? '<i class="fa-solid fa-moon"></i>' : '<i class="fa-solid fa-sun"></i>';
const prismLink = document.getElementById('prism-theme');
if (prismLink) prismLink.href = s.theme === 'dark'
? 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css'
: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css';
const r = parseInt(s.accentColor.slice(1, 3), 16);
const g = parseInt(s.accentColor.slice(3, 5), 16);
const b = parseInt(s.accentColor.slice(5, 7), 16);
document.documentElement.style.setProperty('--accent', s.accentColor);
document.documentElement.style.setProperty('--accent-rgb', `${r},${g},${b}`);
const logoEl = document.getElementById('logo-display');
if (logoEl) logoEl.innerHTML = s.logoDataUrl
? `<img src="${s.logoDataUrl}" alt="logo">`
: `<i class="fa-solid fa-book-open"></i>`;
const faviconLink = document.getElementById('dynamic-favicon');
if (faviconLink) {
if (s.faviconDataUrl) { faviconLink.href = s.faviconDataUrl; faviconLink.type = ''; }
else faviconLink.href = 'data:,';
}
const logoName = document.getElementById('logo-name-display');
if (logoName) logoName.textContent = s.siteName || 'My Docs';
applyFooterDisplay();
document.title = s.tabTitle || 'Docs';
applySpaceTabsVisibility();
applyShareSectionAvailability();
applyTranslateAvailability();
applyTranslations();
}
function toggleTheme() {
S.settings.theme = S.settings.theme === 'dark' ? 'light' : 'dark';
try { localStorage.setItem(THEME_STORAGE_KEY, S.settings.theme); } catch (e) {}
applySettings();
}
// ════════════════════════════════════════
// SPACES (tab bar) + SIDEBAR NAV
// ════════════════════════════════════════
function renderSpaces() {
const strip = document.getElementById('tab-strip');
if (!strip) return;
strip.innerHTML = '';
S.spaces.forEach(sp => {
const spacePageList = S.pages.filter(p => p.spaceId === sp.id);
const firstPage = firstRootPage(spacePageList);
const el = document.createElement('a');
el.className = 'tab-item' + (sp.id === S.currentSpaceId ? ' active' : '');
el.innerHTML = `<i class="fa-solid ${sp.icon || 'fa-book'}"></i><span>${esc(sp.name)}</span>`;
el.href = buildPageHref(firstPage?.id || '');
if (firstPage) {
el.dataset.pageId = firstPage.id;
el.dataset.spaceId = sp.id;
} else {
el.addEventListener('click', event => {
if (!isPrimaryNavigationClick(event)) return;
event.preventDefault();
switchSpace(sp.id);
});
}
strip.appendChild(el);
});
bindViewerPageLinks(strip);
applySpaceTabsVisibility();
}
function switchSpace(id) {
S.currentSpaceId = id;
const pages = spacePages();
const first = firstRootPage(pages);
renderSpaces();
renderNav();
if (first) navigateTo(first.id);
else { S.currentPageId = null; renderPage(); }
}
function renderNav() {
const tree = document.getElementById('nav-tree');
tree.innerHTML = '';
const pages = spacePages();
const rootPages = pages.filter(p => !p.parentId).sort((a, b) => a.order - b.order);
const seen = new Set();
const sections = [];
rootPages.forEach(p => {
const sec = p.section || '';
if (!seen.has(sec)) { seen.add(sec); sections.push(sec); }
});
sections.forEach(sec => {
if (sec) {
const label = document.createElement('div');
label.className = 'section-label';
label.textContent = sec;
tree.appendChild(label);
}
rootPages.filter(p => (p.section || '') === sec).forEach(p => renderNavItem(p, tree, 0, pages));
});
}
function renderNavItem(page, container, depth, allPages) {
const children = allPages.filter(p => p.parentId === page.id).sort((a, b) => a.order - b.order);
const isActive = S.currentPageId === page.id;
const childActive = children.some(c => c.id === S.currentPageId || allPages.filter(x => x.parentId === c.id).some(g => g.id === S.currentPageId));
const isOpen = isActive || childActive;
const wrap = document.createElement('div');
const item = document.createElement('div');
item.className = 'nav-item' + (isActive ? ' active' : '');
item.style.paddingLeft = `${12 + depth * 16}px`;
item.dataset.pageId = page.id;
if (children.length) {
const toggle = document.createElement('button');
toggle.type = 'button';
toggle.className = 'nav-toggle' + (isOpen ? ' open' : '');
toggle.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
toggle.setAttribute('aria-controls', 'children-' + page.id);
toggle.setAttribute('aria-label', `Toggle ${page.title}`);
toggle.innerHTML = '<i class="fa-solid fa-chevron-right"></i>';
toggle.addEventListener('click', () => toggleChildren(toggle, page.id));
item.appendChild(toggle);
} else {
const spacer = document.createElement('div');
spacer.className = 'nav-toggle-spacer';
item.appendChild(spacer);
}
const link = document.createElement('a');
link.className = 'nav-link';
link.href = buildPageHref(page.id);
link.dataset.pageId = page.id;
link.innerHTML = `
<span class="nav-ic"><i class="fa-solid ${page.icon || 'fa-file'}"></i></span>
<span class="nav-label">${esc(page.title)}</span>
`;
item.appendChild(link);
item.addEventListener('mouseenter', () => showHoverPreview(page.id, item));
item.addEventListener('mouseleave', hideHoverPreview);
wrap.appendChild(item);
if (children.length) {
const sub = document.createElement('div');
sub.className = 'nav-children' + (isOpen ? ' open' : '');
sub.id = 'children-' + page.id;
children.forEach(c => renderNavItem(c, sub, depth + 1, allPages));
wrap.appendChild(sub);
}
container.appendChild(wrap);
bindViewerPageLinks(wrap);
}
function toggleChildren(btn, pageId) {
btn.classList.toggle('open');
btn.setAttribute('aria-expanded', btn.classList.contains('open') ? 'true' : 'false');
const sub = document.getElementById('children-' + pageId);
if (sub) sub.classList.toggle('open');
}
// ════════════════════════════════════════
// NAVIGATION
// ════════════════════════════════════════
async function navigateTo(pageId) {
closeMobileSidebar();
if (scrollSpyObserver) { scrollSpyObserver.disconnect(); scrollSpyObserver = null; }
S.currentPageId = pageId;
renderNav();
await loadPageContent(pageId);
renderPage();
history.pushState({ pageId }, '', buildViewerUrl(pageId));
document.querySelector('.content-wrap')?.scrollTo(0, 0);
window.scrollTo(0, 0);
}
// ════════════════════════════════════════
// CONTENT RENDERER (EditorJS-free, read-only)
// Emits the same DOM/classes EditorJS produced so app.css styles it.
// ════════════════════════════════════════
function renderBlocks(content) {
const blocks = (content && content.blocks) || [];
if (!blocks.length) return '';
return blocks.map(b => {
const html = renderBlock(b);
return html ? `<div class="ce-block"><div class="ce-block__content">${html}</div></div>` : '';
}).join('');
}
function renderBlock(b) {
const d = b.data || {};
switch (b.type) {
case 'paragraph': return `<div class="ce-paragraph cdx-block">${d.text || ''}</div>`;
case 'header': {
const lvl = Math.min(6, Math.max(1, d.level || 2));
return `<h${lvl} class="ce-header">${d.text || ''}</h${lvl}>`;
}
case 'list': return renderList(d);
case 'checklist': return renderChecklist(d);
case 'quote': return renderQuote(d);
case 'code': return renderCode(d);
case 'delimiter': {
const st = ['stars','line','dashed','dots'].includes(d.style) ? d.style : 'stars';
return `<div class="ce-delimiter cdx-delimiter cdx-block ce-delimiter--${st}"></div>`;
}
case 'table': return renderTable(d);
case 'image': return renderImage(d);
case 'warning': return renderCallout(d);
case 'timeline': return renderTimeline(d);
case 'collapse': return renderCollapse(d);
case 'video': return renderVideo(d);
case 'cards': return renderCards(d);
default: return d.text ? `<div class="ce-paragraph cdx-block">${d.text}</div>` : '';
}
}
function renderList(d) {
const ordered = d.style === 'ordered';
const tag = ordered ? 'ol' : 'ul';
const cls = ordered ? 'cdx-list cdx-list--ordered' : 'cdx-list cdx-list--unordered';
const build = (items) => {
if (!items || !items.length) return '';
return `<${tag} class="${cls}">` + items.map(it => {
const itemContent = typeof it === 'string' ? it : (it.content || '');
const sub = (it && it.items && it.items.length) ? build(it.items) : '';
return `<li class="cdx-list__item">${itemContent}${sub}</li>`;
}).join('') + `</${tag}>`;
};
return build(d.items || []);
}
function renderChecklist(d) {
const items = d.items || [];
return `<div class="cdx-checklist">` + items.map(it => {
const checked = it.checked ? ' cdx-checklist__item--checked' : '';
return `<div class="cdx-checklist__item${checked}"><span class="cdx-checklist__item-checkbox"></span><div class="cdx-checklist__item-text">${it.text || ''}</div></div>`;
}).join('') + `</div>`;
}
function renderQuote(d) {
return `<blockquote class="cdx-quote"><div class="cdx-quote__text">${d.text || ''}</div>${d.caption ? `<div class="cdx-quote__caption">${d.caption}</div>` : ''}</blockquote>`;
}
function renderCode(d) {
const code = d.code || '';
const lang = detectCodeLanguage(code);
return `<div class="ce-code"><pre class="viewer-code language-${lang}"><code class="language-${lang}">${esc(code)}</code></pre></div>`;
}
function renderTable(d) {
const rows = d.content || [];
const withHeadings = !!d.withHeadings;
let html = `<div class="tc-wrap"><table class="tc-table"><tbody>`;
rows.forEach((row, ri) => {
html += `<tr class="tc-row">`;
(row || []).forEach(cell => {
const tag = (withHeadings && ri === 0) ? 'th' : 'td';
// Preserve line breaks: keep saved <br> and also normalize any raw
// newlines (e.g. from pasted multi-line text) into <br>.
const cellHtml = String(cell || '').replace(/\r\n|\r|\n/g, '<br>');
html += `<${tag} class="tc-cell">${cellHtml}</${tag}>`;
});
html += `</tr>`;
});
html += `</tbody></table></div>`;
return html;
}
function renderImage(d) {
if (!d.url) return '';
const cls = 'local-image-tool'
+ (d.stretched ? ' lit-stretched' : '')
+ (d.withBorder ? ' lit-border' : '')
+ (d.withBackground ? ' lit-bg' : '');
return `<div class="${cls}"><img src="${esc(d.url)}" class="lit-img" alt="${esc(d.caption || '')}">${d.caption ? `<div class="lit-caption">${esc(d.caption)}</div>` : ''}</div>`;
}
function renderCallout(d) {
const TYPES = {
info: { icon: 'fa-circle-info', color: 'var(--accent)', bg: 'rgba(var(--accent-rgb),0.08)' },
tip: { icon: 'fa-lightbulb', color: '#16a34a', bg: 'rgba(22,163,74,0.08)' },
warning: { icon: 'fa-triangle-exclamation', color: '#ca8a04', bg: 'rgba(202,138,4,0.08)' },
danger: { icon: 'fa-circle-exclamation', color: '#dc2626', bg: 'rgba(220,38,38,0.08)' },
};
const cfg = TYPES[d.type] || TYPES.info;
return `<div class="callout-block" style="border-left:3px solid ${cfg.color};background:${cfg.bg};border-radius:6px;padding:12px 16px;width:100%;box-sizing:border-box;">
<div style="display:flex;align-items:flex-start;gap:10px;">
<i class="fa-solid ${cfg.icon}" style="color:${cfg.color};margin-top:2px;flex-shrink:0;font-size:16px;font-style:normal;"></i>
<div style="flex:1;min-width:0;overflow-wrap:break-word;word-break:break-word;">
${d.title ? `<div style="font-weight:600;font-size:14px;color:var(--text);margin-bottom:2px;overflow-wrap:break-word;word-break:break-word;">${d.title}</div>` : ''}
${d.message ? `<div style="font-size:14px;color:var(--text2);line-height:1.5;overflow-wrap:break-word;word-break:break-word;">${d.message}</div>` : ''}
</div>
</div>
</div>`;
}
function renderTimeline(d) {
const numbered = !!d.numbered;
const items = d.items || [];
let html = `<div class="tl-wrap">`;
items.forEach((item, i) => {
html += `<div class="tl-item">`;
html += `<div class="tl-left" style="width:${numbered ? '48px' : '40px'}">`;
html += `<div class="tl-line tl-line-top"></div>`;
html += `<div class="${numbered ? 'tl-dot tl-dot-num' : 'tl-dot'}">${numbered ? (i + 1) : ''}</div>`;
html += `<div class="tl-line"></div>`;
html += `</div><div class="tl-content">`;
if (item.date) html += `<div class="tl-date">${esc(item.date)}</div>`;
if (item.title) html += `<div class="tl-title">${esc(item.title)}</div>`;
if (item.desc) html += `<div class="tl-desc">${esc(item.desc).replace(/\n/g, '<br>')}</div>`;
html += `</div></div>`;
});
html += `</div>`;
return html;
}
function renderCollapse(d) {
const open = d.open ? ' open' : '';
const body = esc(d.body || '').replace(/\n/g, '<br>');
return `<div class="collapsible-block${open}">
<div class="collapsible-header" onclick="this.parentElement.classList.toggle('open')">
<i class="fa-solid fa-chevron-right collapsible-chevron" style="font-style:normal"></i>
<span class="collapsible-title-text">${esc(d.title || 'Section')}</span>
</div>
<div class="collapsible-body">${body}</div>
</div>`;
}
function renderVideo(d) {
if (d && d.src) {
return `<div class="video-block"><video class="video-file" src="${esc(d.src)}" controls preload="metadata" playsinline></video></div>`;
}
if (!d || !d.embedUrl) return '';
return `<div class="video-block"><iframe src="${esc(d.embedUrl)}" allowfullscreen allow="autoplay; encrypted-media"></iframe></div>`;
}
function renderCards(d) {
const cols = d.cols || 3;
const cards = d.cards || [];
let html = `<div class="cards-grid cols-${cols}">`;
cards.forEach(card => {
const linked = card.link ? ' card-linked' : '';
const arrow = card.link ? '<i class="fa-solid fa-arrow-up-right-from-square card-link-arrow" style="font-style:normal"></i>' : '';
let attrs = '';
if (card.link) {
const safe = esc(card.link).replace(/'/g, '%27');
attrs = /^https?:\/\//.test(card.link)
? ` style="cursor:pointer" onclick="window.open('${safe}','_blank','noopener')"`
: ` style="cursor:pointer" onclick="navigateTo('${safe}')"`;
}
html += `<div class="card-item${linked}"${attrs}>${arrow}<div class="card-icon"><i class="fa-solid ${card.icon || 'fa-star'}" style="font-style:normal"></i></div><div class="card-title">${esc(card.title || '')}</div><div class="card-desc">${esc(card.desc || '')}</div></div>`;
});
html += `</div>`;
return html;
}
// ════════════════════════════════════════
// PAGE RENDER
// ════════════════════════════════════════
function renderPage() {
const view = document.getElementById('page-view');
const page = S.pages.find(p => p.id === S.currentPageId);
if (!page) {
view.innerHTML = `<div class="empty-state">
<i class="fa-solid fa-book-open"></i>
<p>${t('pageSelectPrompt')}</p>
</div>`;
syncFeedbackButtons();
updateTOC();
updatePageNavBottom(null);
return;
}
// Breadcrumb — full ancestor trail
const ancestors = [];
let cur = page;
while (cur.parentId) {
const parent = S.pages.find(p => p.id === cur.parentId);
if (!parent) break;
ancestors.unshift(parent);
cur = parent;
}
const breadParts = [];
const sectionSource = ancestors.length ? ancestors[0] : page;
if (sectionSource.section) {
breadParts.push(`<span style="pointer-events:none;cursor:default;">${esc(sectionSource.section)}</span>`);
breadParts.push(`<i class="fa-solid fa-chevron-right"></i>`);
}
ancestors.forEach(a => {
breadParts.push(`<a href="${esc(buildPageHref(a.id))}" data-page-id="${esc(a.id)}">${esc(a.title)}</a>`);
breadParts.push(`<i class="fa-solid fa-chevron-right"></i>`);
});
breadParts.push(`<span>${esc(page.title)}</span>`);
view.innerHTML = `
${page.cover ? `<div class="page-cover" id="page-cover-el" style="${page.cover.type === 'color' ? 'background:' + page.cover.value : ''}">
${page.cover.type === 'image' ? `<img src="${esc(page.cover.value)}" alt="" style="object-fit:${page.cover.fit || 'cover'};object-position:${page.cover.position || '50% 50%'}">` : ''}
</div>` : ''}
<div class="breadcrumb">${breadParts.join('')}</div>
<div class="page-hero">
<div class="page-icon-wrap">
<div class="page-icon"><i class="fa-solid ${page.icon || 'fa-file'}"></i></div>
</div>