{{ message }}
Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
553 lines (507 loc) · 23.3 KB
/
Copy pathindex.html
File metadata and controls
553 lines (507 loc) · 23.3 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.23">
<meta name="description" content="The modular micro web framework for Java">
<meta name="keywords" content="Java, Modern, Micro, Web, Framework, Reactive, Lightweight, Microservices">
<link rel="icon" type="image/png" href="../../images/favicon96.png">
<title>jooby: usage</title>
<link rel="stylesheet" href="../../js/styles/theme.css">
<link rel="stylesheet" href="../../js/styles/atom-one-dark.min.css">
<meta name="algolia-site-verification" content="B92EF92B303805F4">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<script>
// This MUST be in the <head>. It runs before the body is rendered, preventing the white flash.
(function() {
const savedTheme = localStorage.getItem('jooby-theme');
if (savedTheme === 'dark' || (!savedTheme && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.setAttribute('data-theme', 'dark');
}
})();
</script>
</head>
<body class="book toc2 toc-left">
<div class="mobile-nav-bar">
<span style="font-weight: 700; color: var(--heading-color);">Jooby</span>
<button id="menu-toggle" class="hamburger" aria-label="Toggle Menu">
<span></span><span></span><span></span>
</button>
</div>
<div id="header">
<h1>Help/Usage section</h1>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#annotation-processing-tool">Annotation Processing Tool</a>
<ul class="sectlevel2">
<li><a href="#annotation-processing-tool-router-not-found">Router Not Found</a></li>
</ul>
</li>
<li><a href="#bean-converter">Bean Converter</a>
<ul class="sectlevel2">
<li><a href="#bean-converter-parameter-name-missing">Parameter Name Missing</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>This section describes usage error and how to fix them.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="annotation-processing-tool"><a class="anchor" href="#annotation-processing-tool"></a><a class="link" href="#annotation-processing-tool">Annotation Processing Tool</a></h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="annotation-processing-tool-router-not-found"><a class="anchor" href="#annotation-processing-tool-router-not-found"></a><a class="link" href="#annotation-processing-tool-router-not-found">Router Not Found</a></h3>
<div class="paragraph">
<p><strong>Exception</strong>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>Route not found: `...`. Make sure Jooby annotation processor is configured properly.</pre>
</div>
</div>
<div class="paragraph">
<p>The cause of this error is generated when you try to use a MVC route and the annotation processing
tool is not configured properly.</p>
</div>
<div class="paragraph">
<p><strong>Maven Solution</strong>:</p>
</div>
<div class="paragraph">
<p>Java build needs the <code>jooby-apt</code> dependency as <a href="https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#annotationProcessorPaths" target="_blank">annotationProcessorPaths</a>.</p>
</div>
<div class="paragraph">
<p>Kotlin build also requires it via <a href="https://kotlinlang.org/docs/reference/kapt.html#using-in-maven" target="_blank">kapt</a>.</p>
</div>
<div class="listingblock primary">
<div class="switch"><div class="switch--item option-1 selected">Java</div><div class="switch--item option-2">Kotlin</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="x599689c28340443a"> <build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.15.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.jooby</groupId>
<artifactId>jooby-apt</artifactId>
<version>4.5.4</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build></code><button class="clipboard" data-clipboard-target="#x599689c28340443a"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="x9fe8968e8a1441ad"> <build>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>2.4.10</version>
<configuration>
<args>
<arg>-java-parameters</arg>
</args>
<jvmTarget>${maven.compiler.target}</jvmTarget>
</configuration>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>io.jooby</groupId>
<artifactId>jooby-apt</artifactId>
<version>4.5.4</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-kapt</id>
<goals>
<goal>test-kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/test/kotlin</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>io.jooby</groupId>
<artifactId>jooby-apt</artifactId>
<version>4.5.4</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/test/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build></code><button class="clipboard" data-clipboard-target="#x9fe8968e8a1441ad"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>
<div class="paragraph">
<p><strong>Gradle Solution</strong>:</p>
</div>
<div class="paragraph">
<p>Java build needs an annotationProcessor statement using <code>jooby-apt</code>.</p>
</div>
<div class="paragraph">
<p>Kotlin builds needs a <a href="https://kotlinlang.org/docs/reference/kapt.html#using-in-gradle" target="_blank">kapt</a> dependency and statement using <code>jooby-apt</code>.</p>
</div>
<div class="listingblock primary">
<div class="switch"><div class="switch--item option-1 selected">Java</div><div class="switch--item option-2">Kotlin</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy" id="x13d130b2f177438a">dependencies {
annotationProcessor "io.jooby:jooby-apt:4.5.4"
}</code><button class="clipboard" data-clipboard-target="#x13d130b2f177438a"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy" id="xf35fd523a0dc4ba4">buildscript {
...
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.4.10"
}
}
...
apply plugin: "org.jetbrains.kotlin.kapt"
...
dependencies {
kapt "io.jooby:jooby-apt:4.5.4"
}
...</code><button class="clipboard" data-clipboard-target="#xf35fd523a0dc4ba4"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>
<div class="paragraph">
<p><strong>IntelliJ Solution</strong></p>
</div>
<div class="paragraph">
<p>You need to enable IntelliJ annotation processing tool. Please checkout the <a href="https://www.jetbrains.com/help/idea/annotation-processors-support.html" target="_blank">IntelliJ documentation</a> to learn how to do it.</p>
</div>
<div class="paragraph">
<p>Please note that Kapt is still not supported for IntelliJ IDEA’s own build system. A simply workaround
is to configure Intellij to run Maven/Gradle compilation as a build step before running your tests
or application class:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Go to <strong>Run > Edit Configurations …</strong></p>
</li>
<li>
<p>Select the application/test class run configuration</p>
</li>
<li>
<p>Find the <strong>Before build / Build</strong> section</p>
</li>
<li>
<p>Select Add (plus button)</p>
</li>
<li>
<p>Select <strong>Run Maven Goal</strong> or <strong>Run Gradle task</strong></p>
</li>
<li>
<p>For Maven type <code>compile</code> or <code>testCompile</code></p>
</li>
<li>
<p>For Gradle type <code>classes</code> or <code>testClasses</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Now whenever you run tests or the application Mvc classes will be generated at compilation time.</p>
</div>
<div class="paragraph">
<p>Alternatively, you can delegate IntelliJ build/run actions to Maven or Gradle completely:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html" class="bare" target="_blank">https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html</a></p>
</li>
</ul>
</div>
<div class="paragraph">
<p><strong>Eclipse 4.9+</strong></p>
</div>
<div class="paragraph">
<p>You need <a href="https://www.eclipse.org/m2e/" target="_blank">M2Eclipse</a> for Maven or <a href="https://projects.eclipse.org/projects/tools.buildship" target="_blank">Gradle Buildship</a></p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="bean-converter"><a class="anchor" href="#bean-converter"></a><a class="link" href="#bean-converter">Bean Converter</a></h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="bean-converter-parameter-name-missing"><a class="anchor" href="#bean-converter-parameter-name-missing"></a><a class="link" href="#bean-converter-parameter-name-missing">Parameter Name Missing</a></h3>
<div class="paragraph">
<p><strong>Exception</strong>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>Unable to provision parameter at position: '...', require by: ... Parameter's name is missing</pre>
</div>
</div>
<div class="paragraph">
<p>Thrown when the bean converter has no access to a parameter name at runtime. Compilation must be
done using <code>parameters</code> compiler option.</p>
</div>
<div class="paragraph">
<p><strong>Maven Solution</strong></p>
</div>
<div class="listingblock primary">
<div class="switch"><div class="switch--item option-1 selected">Java</div><div class="switch--item option-2">Kotlin</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="x53c1ada4e43a442f"> <build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.15.0</version>
<configuration>
...
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build></code><button class="clipboard" data-clipboard-target="#x53c1ada4e43a442f"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="xd2da893f68b44638"> <build>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>2.4.10</version>
<configuration>
...
<args>
<arg>-java-parameters</arg>
</args>
<jvmTarget>17</jvmTarget>
...
</configuration>
</plugin>
</plugins>
</build></code><button class="clipboard" data-clipboard-target="#xd2da893f68b44638"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>
<div class="paragraph">
<p><strong>Gradle Solution</strong></p>
</div>
<div class="listingblock primary">
<div class="switch"><div class="switch--item option-1 selected">Java</div><div class="switch--item option-2">Kotlin</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy" id="x91971481941043d2">tasks.withType(JavaCompile) {
options.compilerArgs << '-parameters'
options.debug = true
}</code><button class="clipboard" data-clipboard-target="#x91971481941043d2"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy" id="x958416fab61b496c">tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.javaParameters = true
}</code><button class="clipboard" data-clipboard-target="#x958416fab61b496c"><img src="/../../images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>
</div>
</div>
</div>
</div>
<script src="../../js/highlight.min.js"></script>
<script>
if (!hljs.initHighlighting.called) {
hljs.configure({ignoreUnescapedHTML: true});hljs.initHighlighting.called = true
;[].slice.call(document.querySelectorAll('pre.highlight > code[data-lang]')).forEach(function (el) { hljs.highlightElement(el) })
}
</script>
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle Dark Mode">
<svg class="sun-icon" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path d="M12 2.25a.75.75 0 01.75.75v2.25a.75.75 0 01-1.5 0V3a.75.75 0 01.75-.75zM7.5 12a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM18.894 6.166a.75.75 0 00-1.06-1.06l-1.591 1.59a.75.75 0 101.06 1.061l1.591-1.59zM21.75 12a.75.75 0 01-.75.75h-2.25a.75.75 0 010-1.5H21a.75.75 0 01.75.75zM17.834 18.894a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 10-1.061 1.06l1.59 1.591zM12 18.75a.75.75 0 01.75.75V21a.75.75 0 01-1.5 0v-1.5a.75.75 0 01.75-.75zM6.166 18.894a.75.75 0 01-1.06-1.06l1.59-1.591a.75.75 0 111.061 1.06l-1.59 1.591zM2.25 12a.75.75 0 01.75-.75h2.25a.75.75 0 010 1.5H3a.75.75 0 01-.75-.75zM5.106 6.166a.75.75 0 011.06-1.06l1.591 1.59a.75.75 0 11-1.06 1.061l-1.591-1.59z" /></svg>
<svg class="moon-icon" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path fill-rule="evenodd" d="M9.528 1.718a.75.75 0 01.162.819A8.97 8.97 0 009 6a9 9 0 009 9 8.97 8.97 0 003.463-.69.75.75 0 01.981.98 10.503 10.503 0 01-9.694 6.46c-5.799 0-10.5-4.701-10.5-10.5 0-4.368 2.667-8.112 6.46-9.694a.75.75 0 01.818.162z" clip-rule="evenodd" /></svg>
</button>
<script src="/../../js/clipboard.min.js"></script>
<script src="/../../js/toc.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
/** 1. Theme Switcher Logic */
const themeToggle = document.getElementById('theme-toggle');
const htmlElement = document.documentElement;
const hljsThemeLink = document.getElementById('hljs-theme'); // Grab the CSS link
if (themeToggle) {
themeToggle.addEventListener('click', () => {
if (htmlElement.getAttribute('data-theme') === 'dark') {
// Switch to Light Mode
htmlElement.removeAttribute('data-theme');
localStorage.setItem('jooby-theme', 'light');
// Switch code block to Agate
if (hljsThemeLink) hljsThemeLink.href = '../../js/styles/agate.min.css';
} else {
// Switch to Dark Mode
htmlElement.setAttribute('data-theme', 'dark');
localStorage.setItem('jooby-theme', 'dark');
// Switch code block to Atom One Dark
if (hljsThemeLink) hljsThemeLink.href = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.../../js/11.9.0/styles/atom-one-dark.min.css';
}
});
}
/** 2. Tabs Logic */
const tabButtons = document.querySelectorAll('.primary .switch .switch--item');
const contents = document.querySelectorAll('.primary .content');
tabButtons.forEach(button => {
button.addEventListener('click', function () {
const match = this.className.match(/option-(\d+)/);
if (!match) return;
const option = match[1];
// Reset states
tabButtons.forEach(btn => btn.classList.remove('selected'));
contents.forEach(content => content.classList.add('hidden'));
// Set active states
document.querySelectorAll(`.primary .switch .switch--item.option-${option}`)
.forEach(el => el.classList.add('selected'));
document.querySelectorAll(`.primary .content.option-${option}`)
.forEach(el => el.classList.remove('hidden'));
});
});
/** 3. Clipboard.js Initialization */
const clipboard = new ClipboardJS('.clipboard');
clipboard.on('success', (e) => {
e.clearSelection();
const btn = e.trigger;
const originalHTML = btn.innerHTML;
// Temporarily change background and insert a checkmark SVG
btn.style.backgroundColor = '#10b981'; // Tailwind emerald-500
btn.style.borderColor = '#059669';
btn.innerHTML = `<svg fill="none" stroke="white" stroke-width="2.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>`;
// Revert back after 2 seconds
setTimeout(() => {
btn.style.backgroundColor = '';
btn.style.borderColor = '';
btn.innerHTML = originalHTML;
}, 2000);
});
});
/** 4. Code Callout Badges (Zero-Flash & Auto-Format) */
document.querySelectorAll('pre.highlightjs').forEach(pre => {
// Check every 10ms if highlight.js has finished formatting this block
const checkInterval = setInterval(() => {
if (pre.dataset.highlighted === "yes" || pre.querySelector('.hljs')) {
clearInterval(checkInterval);
const codeEl = pre.querySelector('code');
if (codeEl) {
// Upgraded regex to handle consecutive callouts like: // (1) (2)
// The "Lookahead" (?= ... ) now checks if the rest of the line
// is empty OR contains subsequent (N) callout numbers.
const calloutRegex = /(\/\/\s*|\s+)\(\s*(?:<[^>]+>\s*)*(\d+)\s*(?:<[^>]+>\s*)*\)(?=\s*(?:<[^>]+>\s*)*(?:\(\s*(?:<[^>]+>\s*)*\d+\s*(?:<[^>]+>\s*)*\)\s*(?:<[^>]+>\s*)*)*(\n|<|$))/g;
codeEl.innerHTML = codeEl.innerHTML.replace(
calloutRegex,
(match, prefix, num) => {
// Injects a hidden "//" before EVERY badge so that
// multiple badges paste safely as "// 1 // 2"
return ` <span class="visually-hidden">//</span> <span class="conum-badge">${num}</span>`;
}
);
}
// Reveal the block smoothly
pre.classList.add('badges-loaded');
}
}, 10);
// Fallback: Reveal the block anyway after 500ms
setTimeout(() => {
pre.classList.add('badges-loaded');
clearInterval(checkInterval);
}, 500);
});
/** 5. Copy Header Anchor Links to Clipboard */
document.querySelectorAll('a.anchor').forEach(anchor => {
anchor.addEventListener('click', function(e) {
// We do NOT prevent default, so the browser still scrolls to the header naturally
// Construct the full absolute URL for the clipboard
const fullUrl = window.location.origin + window.location.pathname + window.location.search + this.getAttribute('href');
// Use native clipboard API
navigator.clipboard.writeText(fullUrl).then(() => {
// Add the 'copied' class for visual feedback
this.classList.add('copied');
// Remove the checkmark after 2 seconds
setTimeout(() => {
this.classList.remove('copied');
}, 2000);
}).catch(err => console.error('Failed to copy anchor:', err));
});
});
/** 6. Hamburger Menu */
document.addEventListener('DOMContentLoaded', function() {
const menuToggle = document.getElementById('menu-toggle');
// Try to find the Toc (Table of Contents) or the Navigation Container
const sidebar = document.getElementById('toc') ||
document.querySelector('.nav-container') ||
document.getElementById('sidebar');
if (menuToggle && sidebar) {
menuToggle.addEventListener('click', function() {
sidebar.classList.toggle('active');
menuToggle.classList.toggle('open');
// Optional: Prevent body scrolling when menu is open
document.body.classList.toggle('menu-open');
});
} else {
console.warn("Hamburger menu: Could not find the navigation element to toggle.");
}
});
</script>
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// 1. Find Asciidoctor's auto-generated TOC
const toc = document.getElementById('toc');
if (toc) {
// 2. Create the search container dynamically
const searchContainer = document.createElement('div');
searchContainer.id = 'docsearch';
// 3. Inject it at the very top of the TOC, above the title
toc.insertBefore(searchContainer, toc.firstChild);
// 4. Initialize Algolia into that new container
docsearch({
appId: '9U2WK2CSJ7',
apiKey: '113e159f5c587fdac629948dd80dd993',
indexName: 'jooby',
container: '#docsearch'
});
} else {
console.warn("Could not find the #toc element to inject the search bar.");
}
});
</script>
</body>
</html>
You can’t perform that action at this time.
