index.hbs

  1<!DOCTYPE HTML>
  2<html lang="{{ language }}" data-theme="{{ default_theme }}" data-color-scheme="{{ default_theme }}" dir="{{ text_direction }}">
  3    <head>
  4        <!-- Book generated using mdBook -->
  5        <meta charset="UTF-8">
  6        <title>{{ title }}</title>
  7        {{#if is_print }}
  8        <meta name="robots" content="noindex">
  9        {{/if}}
 10        {{#if base_url}}
 11        <base href="{{ base_url }}">
 12        {{/if}}
 13
 14
 15        <!-- Custom HTML head -->
 16        {{> head}}
 17
 18        <meta name="description" content="#description#">
 19        <meta name="viewport" content="width=device-width, initial-scale=1">
 20        <meta name="theme-color" content="#ffffff">
 21
 22        <link rel="shortcut icon" href="{{ path_to_root }}favicon.png">
 23        <link rel="stylesheet" href="{{ path_to_root }}css/variables.css">
 24        <link rel="stylesheet" href="{{ path_to_root }}css/general.css">
 25        <link rel="stylesheet" href="{{ path_to_root }}css/chrome.css">
 26        {{#if print_enable}}
 27        <link rel="stylesheet" href="{{ path_to_root }}css/print.css" media="print">
 28        {{/if}}
 29
 30        <!-- Fonts -->
 31        <link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css">
 32        {{#if copy_fonts}}
 33        <link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css">
 34        {{/if}}
 35
 36        <!-- Highlight.js Stylesheets -->
 37        <link rel="stylesheet" href="{{ path_to_root }}highlight.css">
 38        <link rel="stylesheet" href="{{ path_to_root }}tomorrow-night.css">
 39        <link rel="stylesheet" href="{{ path_to_root }}ayu-highlight.css">
 40
 41        <!-- Custom theme stylesheets -->
 42        {{#each additional_css}}
 43        <link rel="stylesheet" href="{{ ../path_to_root }}{{ this }}">
 44        {{/each}}
 45
 46        {{#if mathjax_support}}
 47        <!-- MathJax -->
 48        <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
 49        {{/if}}
 50    </head>
 51    <body class="sidebar-visible no-js">
 52    <div id="body-container">
 53        <!-- Provide site root to javascript -->
 54        <script>
 55            var path_to_root = "{{ path_to_root }}";
 56            var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
 57        </script>
 58
 59        <!-- Support dark mode -->
 60        <script>
 61            var theme;
 62            try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
 63            if (theme === null || theme === undefined) {
 64                theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
 65            }
 66            var html = document.querySelector('html');
 67            html.classList.remove('light', 'dark')
 68            html.classList.add(theme);
 69            var body = document.querySelector('body');
 70            body.classList.remove('no-js')
 71            body.classList.add('js');
 72        </script>
 73
 74        <input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
 75
 76        <!-- Hide / unhide sidebar before it is displayed -->
 77        <script>
 78            var body = document.querySelector('body');
 79            var sidebar = null;
 80            var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
 81            if (document.body.clientWidth >= 1080) {
 82                try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
 83                sidebar = sidebar || 'visible';
 84            } else {
 85                sidebar = 'hidden';
 86            }
 87            sidebar_toggle.checked = sidebar === 'visible';
 88            body.classList.remove('sidebar-visible');
 89            body.classList.add("sidebar-" + sidebar);
 90        </script>
 91
 92        <nav id="sidebar" class="sidebar" aria-label="Table of contents">
 93            <div class="sidebar-scrollbox">
 94                {{#toc}}{{/toc}}
 95            </div>
 96            <div style="display: none;" id="sidebar-resize-handle" class="sidebar-resize-handle">
 97                <div class="sidebar-resize-indicator"></div>
 98            </div>
 99        </nav>
100
101        <!-- Track and set sidebar scroll position -->
102        <script>
103            var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
104            sidebarScrollbox.addEventListener('click', function(e) {
105                if (e.target.tagName === 'A') {
106                    sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
107                }
108            }, { passive: true });
109            var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
110            sessionStorage.removeItem('sidebar-scroll');
111            if (sidebarScrollTop) {
112                // preserve sidebar scroll position when navigating via links within sidebar
113                sidebarScrollbox.scrollTop = sidebarScrollTop;
114            } else {
115                // scroll sidebar to current active section when navigating via "next/previous chapter" buttons
116                var activeSection = document.querySelector('#sidebar .active');
117                if (activeSection) {
118                    activeSection.scrollIntoView({ block: 'center' });
119                }
120            }
121        </script>
122
123        <div id="page-wrapper" class="page-wrapper">
124            <div class="page">
125                {{> header}}
126                <div id="menu-bar-hover-placeholder"></div>
127                <div id="menu-bar" class="menu-bar sticky">
128                    <div class="left-buttons">
129
130                        <label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
131                            <i class="fa fa-bars"></i>
132                        </label>
133
134                        <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
135                            <i class="fa fa-paint-brush"></i>
136                        </button>
137                        <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
138                            <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
139                            <li role="none"><button role="menuitem" class="theme" id="dark">Dark</button></li>
140                        </ul>
141
142                        {{#if search_enabled}}
143                        <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
144                            <i class="fa fa-search"></i>
145                        </button>
146                        {{/if}}
147                    </div>
148
149                    <header class="menu-title">
150                        <a href="/">
151                            <img src="https://zed.dev/logo_wordmark_1500.webp" alt="Zed Industries" style="height: 28px;">
152                        </a>
153                    </header>
154
155                    <div class="right-buttons">
156                        <a class="download-button" href="https://zed.dev/download" title="Download Zed" aria-label="Download Zed">
157                            Download
158                        </a>
159                        {{#if git_repository_url}}
160                        <a href="{{git_repository_url}}" title="Git repository" aria-label="Git repository">
161                            <i id="git-repository-button" class="fa {{git_repository_icon}}"></i>
162                        </a>
163                        {{/if}}
164                        {{#if git_repository_edit_url}}
165                        <a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit">
166                            <i id="git-edit-button" class="fa fa-edit"></i>
167                        </a>
168                        {{/if}}
169                    </div>
170                </div>
171
172                {{#if search_enabled}}
173                <div id="search-wrapper" class="hidden">
174                    <form id="searchbar-outer" class="searchbar-outer">
175                        <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
176                    </form>
177                    <div id="searchresults-outer" class="searchresults-outer hidden">
178                        <div id="searchresults-header" class="searchresults-header"></div>
179                        <ul id="searchresults">
180                        </ul>
181                    </div>
182                </div>
183                {{/if}}
184
185                <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
186                <script>
187                    document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
188                    document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
189                    Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
190                        link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
191                    });
192                </script>
193
194                <div id="content" class="content">
195                    <main>
196                      <div class="sidetoc">
197                          <nav class="pagetoc">
198                            <p class="toc-title">On this page</p>
199                          </nav>
200                      </div>
201                      {{{ content }}}
202                        <div class="footer-buttons">
203                            {{#previous}}
204                            <a rel="prev" href="{{ path_to_root }}{{link}}" class="footer-button" title="{{title}}">
205                                <i class="fa fa-angle-left"></i>
206                                {{title}}
207                            </a>
208                            {{/previous}}
209                            {{#next}}
210                            <a rel="next" href="{{ path_to_root }}{{link}}" class="footer-button" title="{{title}}">
211                                {{title}}
212                                <i class="fa fa-angle-right"></i>
213                            </a>
214                            {{/next}}
215                        </div>
216                    </main>
217                </div>
218            </div>
219        </div>
220
221        {{#if live_reload_endpoint}}
222        <!-- Livereload script (if served using the cli tool) -->
223        <script>
224            const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
225            const wsAddress = wsProtocol + "//" + location.host + "/" + "{{{live_reload_endpoint}}}";
226            const socket = new WebSocket(wsAddress);
227            socket.onmessage = function (event) {
228                if (event.data === "reload") {
229                    socket.close();
230                    location.reload();
231                }
232            };
233
234            window.onbeforeunload = function() {
235                socket.close();
236            }
237        </script>
238        {{/if}}
239
240        {{#if playground_line_numbers}}
241        <script>
242            window.playground_line_numbers = true;
243        </script>
244        {{/if}}
245
246        {{#if playground_copyable}}
247        <script>
248            window.playground_copyable = true;
249        </script>
250        {{/if}}
251
252        {{#if playground_js}}
253        <script src="{{ path_to_root }}ace.js"></script>
254        <script src="{{ path_to_root }}editor.js"></script>
255        <script src="{{ path_to_root }}mode-rust.js"></script>
256        <script src="{{ path_to_root }}theme-dawn.js"></script>
257        <script src="{{ path_to_root }}theme-tomorrow_night.js"></script>
258        {{/if}}
259
260        {{#if search_js}}
261        <script src="{{ path_to_root }}elasticlunr.min.js"></script>
262        <script src="{{ path_to_root }}mark.min.js"></script>
263        <script src="{{ path_to_root }}searcher.js"></script>
264        {{/if}}
265
266        <script src="{{ path_to_root }}clipboard.min.js"></script>
267        <script src="{{ path_to_root }}highlight.js"></script>
268        <script src="{{ path_to_root }}book.js"></script>
269
270        <!-- Custom JS scripts -->
271        {{#each additional_js}}
272        <script src="{{ ../path_to_root }}{{this}}"></script>
273        {{/each}}
274
275        {{#if is_print}}
276        {{#if mathjax_support}}
277        <script>
278        window.addEventListener('load', function() {
279            MathJax.Hub.Register.StartupHook('End', function() {
280                window.setTimeout(window.print, 100);
281            });
282        });
283        </script>
284        {{else}}
285        <script>
286        window.addEventListener('load', function() {
287            window.setTimeout(window.print, 100);
288        });
289        </script>
290        {{/if}}
291        {{/if}}
292
293        <script>
294          (function() {
295            var theme = localStorage.getItem('mdbook-theme');
296            var html = document.querySelector('html');
297            if (theme) {
298              html.setAttribute('data-theme', theme);
299              html.setAttribute('data-color-scheme', theme);
300              html.className = theme;
301            } else {
302              var systemPreference = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
303              html.setAttribute('data-theme', systemPreference);
304              html.setAttribute('data-color-scheme', systemPreference);
305              html.className = systemPreference;
306            }
307          })();
308        </script>
309
310
311    </div>
312    </body>
313</html>