@@ -14,9 +14,10 @@ interface Props {
1414 canonicalPath? : string ;
1515 prev? : { label: string ; href: string };
1616 next? : { label: string ; href: string };
17+ hidePageNav? : boolean ;
1718}
1819
19- const { title, description, activePage, canonicalPath, prev, next } = Astro .props ;
20+ const { title, description, activePage, canonicalPath, prev, next, hidePageNav } = Astro .props ;
2021const canonicalUrl = canonicalPath ? ` https://pilotprotocol.network${canonicalPath } ` : undefined ;
2122
2223const breadcrumbItems = [
@@ -31,6 +32,7 @@ if (activePage !== 'index') {
3132<html lang =" en" >
3233<head >
3334 <BaseHead title ={ title } description ={ description } canonicalUrl ={ canonicalUrl } />
35+ <link rel =" stylesheet" href =" https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" />
3436 <script type =" application/ld+json" set:html ={ JSON .stringify ({
3537 " @context" : " https://schema.org" ,
3638 " @type" : " WebPage" ,
@@ -54,11 +56,61 @@ if (activePage !== 'index') {
5456<body >
5557 <Topbar variant =" docs" />
5658 <DocSidebar activePage ={ activePage } />
59+ <aside class =" toc-sidebar" id =" toc-sidebar" ></aside >
5760 <div class =" content" >
58- { activePage !== ' index' && <nav class = " breadcrumb" aria-label = " Breadcrumb" ><a href = " /" >Home</a > <span class = " sep" >/</span > <a href = " /docs/" >Docs</a > <span class = " sep" >/</span > <span >{ title } </span ></nav >}
59- <slot />
60- <PageNav prev ={ prev } next ={ next } />
61+ <div class =" content-body" >
62+ { activePage !== ' index' && <nav class = " breadcrumb" aria-label = " Breadcrumb" ><a href = " /" >Home</a > <span class = " sep" >/</span > <a href = " /docs/" >Docs</a > <span class = " sep" >/</span > <span >{ title } </span ></nav >}
63+ { activePage !== ' index' && (
64+ <a class = " back-overview" href = " /docs/#flow" >
65+ <svg viewBox = " 0 0 24 24" ><line x1 = " 19" y1 = " 12" x2 = " 5" y2 = " 12" /><polyline points = " 12 19 5 12 12 5" /></svg >
66+ Flow
67+ </a >
68+ )}
69+ <slot />
70+ { ! hidePageNav && <PageNav prev = { prev } next = { next } />}
71+ </div >
6172 </div >
6273 <DocFooter />
74+ <script src =" https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js" defer ></script >
75+ <script src =" https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js" defer ></script >
76+ <script src =" https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js" defer ></script >
77+ <script >
78+ (function() {
79+ const sidebar = document.getElementById('toc-sidebar');
80+ if (!sidebar) return;
81+ const content = document.querySelector('.content');
82+ if (!content) return;
83+ const headings = Array.from(content.querySelectorAll('h2[id], h3[id]'));
84+ if (headings.length === 0) return;
85+
86+ const title = document.createElement('div');
87+ title.className = 'toc-title';
88+ title.textContent = 'On this page';
89+ sidebar.appendChild(title);
90+
91+ const links: HTMLAnchorElement[] = [];
92+ headings.forEach(h => {
93+ const a = document.createElement('a');
94+ a.href = '#' + h.id;
95+ a.textContent = h.textContent || '';
96+ if (h.tagName === 'H3') a.classList.add('toc-h3');
97+ sidebar.appendChild(a);
98+ links.push(a);
99+ });
100+
101+ // Scroll spy
102+ const observer = new IntersectionObserver(entries => {
103+ entries.forEach(entry => {
104+ if (entry.isIntersecting) {
105+ links.forEach(l => l.classList.remove('active'));
106+ const active = links.find(l => l.getAttribute('href') === '#' + entry.target.id);
107+ if (active) active.classList.add('active');
108+ }
109+ });
110+ }, { rootMargin: '-56px 0px -60% 0px', threshold: 0 });
111+
112+ headings.forEach(h => observer.observe(h));
113+ })();
114+ </script >
63115</body >
64116</html >
0 commit comments