rdoc 6.15.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +187 -0
  3. data/History.rdoc +1 -1
  4. data/LEGAL.rdoc +6 -0
  5. data/README.md +20 -3
  6. data/lib/rdoc/code_object/any_method.rb +15 -7
  7. data/lib/rdoc/code_object/class_module.rb +13 -0
  8. data/lib/rdoc/code_object/constant.rb +9 -0
  9. data/lib/rdoc/code_object/method_attr.rb +13 -1
  10. data/lib/rdoc/code_object/top_level.rb +31 -18
  11. data/lib/rdoc/comment.rb +190 -8
  12. data/lib/rdoc/generator/aliki.rb +183 -0
  13. data/lib/rdoc/generator/darkfish.rb +5 -1
  14. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  15. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  16. data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
  17. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  18. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  19. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  20. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  21. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
  22. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
  23. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  24. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  25. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  26. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  27. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  28. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  29. data/lib/rdoc/generator/template/aliki/class.rhtml +218 -0
  30. data/lib/rdoc/generator/template/aliki/css/rdoc.css +1944 -0
  31. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  32. data/lib/rdoc/generator/template/aliki/js/aliki.js +498 -0
  33. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  34. data/lib/rdoc/generator/template/aliki/js/search_controller.js +120 -0
  35. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  36. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  37. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  38. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  39. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  40. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  41. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  42. data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -19
  43. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
  44. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
  45. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  46. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
  47. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +19 -19
  48. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
  49. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
  50. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
  51. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
  52. data/lib/rdoc/generator/template/darkfish/class.rhtml +62 -62
  53. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
  54. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
  55. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
  56. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
  57. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
  58. data/lib/rdoc/generator/template/json_index/js/searcher.js +43 -6
  59. data/lib/rdoc/generator.rb +1 -0
  60. data/lib/rdoc/markup/pre_process.rb +34 -10
  61. data/lib/rdoc/markup/to_ansi.rb +4 -0
  62. data/lib/rdoc/markup/to_bs.rb +4 -0
  63. data/lib/rdoc/markup/to_html.rb +6 -4
  64. data/lib/rdoc/markup/to_rdoc.rb +11 -3
  65. data/lib/rdoc/options.rb +21 -10
  66. data/lib/rdoc/parser/c.rb +15 -46
  67. data/lib/rdoc/parser/prism_ruby.rb +121 -113
  68. data/lib/rdoc/parser/ruby.rb +8 -8
  69. data/lib/rdoc/parser/ruby_tools.rb +5 -7
  70. data/lib/rdoc/parser/simple.rb +4 -21
  71. data/lib/rdoc/rdoc.rb +1 -0
  72. data/lib/rdoc/rubygems_hook.rb +3 -3
  73. data/lib/rdoc/text.rb +1 -1
  74. data/lib/rdoc/token_stream.rb +13 -1
  75. data/lib/rdoc/tom_doc.rb +1 -1
  76. data/lib/rdoc/version.rb +1 -1
  77. data/rdoc.gemspec +1 -1
  78. metadata +33 -5
  79. data/CONTRIBUTING.rdoc +0 -219
@@ -0,0 +1,22 @@
1
+ <body role="document" class="file has-toc">
2
+ <%= render '_icons.rhtml' %>
3
+ <%= render '_header.rhtml' %>
4
+ <%= render '_sidebar_toggle.rhtml' %>
5
+
6
+ <nav id="navigation" role="navigation">
7
+ <%= render '_sidebar_pages.rhtml' %>
8
+ <%= render '_sidebar_classes.rhtml' %>
9
+ </nav>
10
+
11
+ <main role="main">
12
+ <%- if @main_page %>
13
+ <%= @main_page.description %>
14
+ <%- else %>
15
+ <p>This is the API documentation for <%= h @title %>.</p>
16
+ <%- end %>
17
+ </main>
18
+
19
+ <%= render '_aside_toc.rhtml' %>
20
+
21
+ <%= render '_footer.rhtml' %>
22
+ </body>
@@ -0,0 +1,498 @@
1
+ 'use strict';
2
+
3
+ /* ===== Method Source Code Toggling ===== */
4
+
5
+ function showSource(e) {
6
+ let target = e.target;
7
+ while (!target.classList.contains('method-detail')) {
8
+ target = target.parentNode;
9
+ }
10
+ if (typeof target !== "undefined" && target !== null) {
11
+ target = target.querySelector('.method-source-code');
12
+ }
13
+ if (typeof target !== "undefined" && target !== null) {
14
+ target.classList.toggle('active-menu')
15
+ }
16
+ }
17
+
18
+ function hookSourceViews() {
19
+ document.querySelectorAll('.method-source-toggle').forEach((codeObject) => {
20
+ codeObject.addEventListener('click', showSource);
21
+ });
22
+ }
23
+
24
+ /* ===== Search Functionality ===== */
25
+
26
+ function createSearchInstance(input, result) {
27
+ if (!input || !result) return null;
28
+
29
+ result.classList.remove("initially-hidden");
30
+
31
+ const search = new SearchController(search_data, input, result);
32
+
33
+ search.renderItem = function(result) {
34
+ const li = document.createElement('li');
35
+ let html = '';
36
+
37
+ // TODO add relative path to <script> per-page
38
+ html += `<p class="search-match"><a href="${index_rel_prefix}${this.escapeHTML(result.path)}">${this.hlt(result.title)}`;
39
+ if (result.params)
40
+ html += `<span class="params">${result.params}</span>`;
41
+ html += '</a>';
42
+
43
+ // Add type indicator
44
+ if (result.type) {
45
+ const typeLabel = this.formatType(result.type);
46
+ const typeClass = result.type.replace(/_/g, '-');
47
+ html += `<span class="search-type search-type-${this.escapeHTML(typeClass)}">${typeLabel}</span>`;
48
+ }
49
+
50
+ if (result.snippet)
51
+ html += `<div class="search-snippet">${result.snippet}</div>`;
52
+
53
+ li.innerHTML = html;
54
+
55
+ return li;
56
+ }
57
+
58
+ search.formatType = function(type) {
59
+ const typeLabels = {
60
+ 'class': 'class',
61
+ 'module': 'module',
62
+ 'constant': 'const',
63
+ 'instance_method': 'method',
64
+ 'class_method': 'method'
65
+ };
66
+ return typeLabels[type] || type;
67
+ }
68
+
69
+ search.select = function(result) {
70
+ let href = result.firstChild.firstChild.href;
71
+ const query = this.input.value;
72
+ if (query) {
73
+ const url = new URL(href, window.location.origin);
74
+ url.searchParams.set('q', query);
75
+ url.searchParams.set('nav', '0');
76
+ href = url.toString();
77
+ }
78
+ window.location.href = href;
79
+ }
80
+
81
+ search.scrollIntoView = search.scrollInWindow;
82
+
83
+ return search;
84
+ }
85
+
86
+ function hookSearch() {
87
+ const input = document.querySelector('#search-field');
88
+ const result = document.querySelector('#search-results-desktop');
89
+
90
+ if (!input || !result) return; // Exit if search elements not found
91
+
92
+ const search_section = document.querySelector('#search-section');
93
+ if (search_section) {
94
+ search_section.classList.remove("initially-hidden");
95
+ }
96
+
97
+ const search = createSearchInstance(input, result);
98
+ if (!search) return;
99
+
100
+ // Check for ?q= URL parameter and trigger search automatically
101
+ if (typeof URLSearchParams !== 'undefined') {
102
+ const urlParams = new URLSearchParams(window.location.search);
103
+ const queryParam = urlParams.get('q');
104
+ if (queryParam) {
105
+ const navParam = urlParams.get('nav');
106
+ const autoSelect = navParam !== '0';
107
+ input.value = queryParam;
108
+ search.search(queryParam, autoSelect);
109
+ }
110
+ }
111
+ }
112
+
113
+ /* ===== Keyboard Shortcuts ===== */
114
+
115
+ function hookFocus() {
116
+ document.addEventListener("keydown", (event) => {
117
+ if (document.activeElement.tagName === 'INPUT') {
118
+ return;
119
+ }
120
+ if (event.key === "/") {
121
+ event.preventDefault();
122
+ document.querySelector('#search-field').focus();
123
+ }
124
+ });
125
+ }
126
+
127
+ /* ===== Mobile Navigation ===== */
128
+
129
+ function hookSidebar() {
130
+ const navigation = document.querySelector('#navigation');
131
+ const navigationToggle = document.querySelector('#navigation-toggle');
132
+
133
+ if (!navigation || !navigationToggle) return;
134
+
135
+ const closeNav = () => {
136
+ navigation.hidden = true;
137
+ navigationToggle.ariaExpanded = 'false';
138
+ document.body.classList.remove('nav-open');
139
+ };
140
+
141
+ const openNav = () => {
142
+ navigation.hidden = false;
143
+ navigationToggle.ariaExpanded = 'true';
144
+ document.body.classList.add('nav-open');
145
+ };
146
+
147
+ const toggleNav = () => {
148
+ if (navigation.hidden) {
149
+ openNav();
150
+ } else {
151
+ closeNav();
152
+ }
153
+ };
154
+
155
+ navigationToggle.addEventListener('click', (e) => {
156
+ e.stopPropagation();
157
+ toggleNav();
158
+ });
159
+
160
+ const isSmallViewport = window.matchMedia("(max-width: 1023px)").matches;
161
+ if (isSmallViewport) {
162
+ closeNav();
163
+
164
+ // Close nav when clicking links inside it
165
+ document.addEventListener('click', (e) => {
166
+ if (e.target.closest('#navigation a')) {
167
+ closeNav();
168
+ }
169
+ });
170
+
171
+ // Close nav when clicking backdrop
172
+ document.addEventListener('click', (e) => {
173
+ if (!navigation.hidden &&
174
+ !e.target.closest('#navigation') &&
175
+ !e.target.closest('#navigation-toggle')) {
176
+ closeNav();
177
+ }
178
+ });
179
+ }
180
+ }
181
+
182
+ /* ===== Right Sidebar Table of Contents ===== */
183
+
184
+ function generateToc() {
185
+ const tocNav = document.querySelector('#toc-nav');
186
+ if (!tocNav) return; // Exit if TOC nav doesn't exist
187
+
188
+ const main = document.querySelector('main');
189
+ if (!main) return;
190
+
191
+ // Find all h2 and h3 headings in the main content
192
+ const headings = main.querySelectorAll('h1, h2, h3');
193
+ if (headings.length === 0) return;
194
+
195
+ const tocList = document.createElement('ul');
196
+ tocList.className = 'toc-list';
197
+
198
+ headings.forEach((heading) => {
199
+ // Skip if heading doesn't have an id
200
+ if (!heading.id) return;
201
+
202
+ const li = document.createElement('li');
203
+ const level = heading.tagName.toLowerCase();
204
+ li.className = `toc-item toc-${level}`;
205
+
206
+ const link = document.createElement('a');
207
+ link.href = `#${heading.id}`;
208
+ link.className = 'toc-link';
209
+ link.textContent = heading.textContent.trim();
210
+ link.setAttribute('data-target', heading.id);
211
+
212
+ li.appendChild(link);
213
+ setHeadingScrollHandler(heading, link);
214
+ tocList.appendChild(li);
215
+ });
216
+
217
+ if (tocList.children.length > 0) {
218
+ tocNav.appendChild(tocList);
219
+ } else {
220
+ // Hide TOC if no headings found
221
+ const tocContainer = document.querySelector('.table-of-contents');
222
+ if (tocContainer) {
223
+ tocContainer.style.display = 'none';
224
+ }
225
+ }
226
+ }
227
+
228
+ function hookTocActiveHighlighting() {
229
+ const tocLinks = document.querySelectorAll('.toc-link');
230
+ const targetHeadings = [];
231
+ tocLinks.forEach((link) => {
232
+ const targetId = link.getAttribute('data-target');
233
+ const heading = document.getElementById(targetId);
234
+ if (heading) {
235
+ targetHeadings.push(heading);
236
+ }
237
+ });
238
+
239
+ if (targetHeadings.length === 0) return;
240
+
241
+ const observerOptions = {
242
+ root: null,
243
+ rootMargin: '0% 0px -35% 0px',
244
+ threshold: 0
245
+ };
246
+
247
+ const intersectingHeadings = new Set();
248
+ const update = () => {
249
+ const firstIntersectingHeading = targetHeadings.find((heading) => {
250
+ return intersectingHeadings.has(heading);
251
+ });
252
+ if (!firstIntersectingHeading) return;
253
+ const correspondingLink = document.querySelector(`.toc-link[data-target="${firstIntersectingHeading.id}"]`);
254
+ if (!correspondingLink) return;
255
+
256
+ // Remove active class from all links
257
+ tocLinks.forEach((link) => {
258
+ link.classList.remove('active');
259
+ });
260
+
261
+ // Add active class to current link
262
+ correspondingLink.classList.add('active');
263
+
264
+ // Scroll link into view if needed
265
+ const tocNav = document.querySelector('#toc-nav');
266
+ if (tocNav) {
267
+ const linkRect = correspondingLink.getBoundingClientRect();
268
+ const navRect = tocNav.getBoundingClientRect();
269
+
270
+ if (linkRect.top < navRect.top || linkRect.bottom > navRect.bottom) {
271
+ correspondingLink.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
272
+ }
273
+ }
274
+ };
275
+ const observer = new IntersectionObserver((entries) => {
276
+ entries.forEach((entry) => {
277
+ if (entry.isIntersecting) {
278
+ intersectingHeadings.add(entry.target);
279
+ } else {
280
+ intersectingHeadings.delete(entry.target);
281
+ }
282
+ });
283
+ update();
284
+ }, observerOptions);
285
+
286
+ // Observe all headings that have corresponding TOC links
287
+ targetHeadings.forEach((heading) => {
288
+ observer.observe(heading);
289
+ });
290
+ }
291
+
292
+ function setHeadingScrollHandler(heading, link) {
293
+ // Smooth scroll to heading when clicking link
294
+ if (!heading.id) return;
295
+
296
+ link.addEventListener('click', (e) => {
297
+ e.preventDefault();
298
+ heading.scrollIntoView({ behavior: 'smooth', block: 'start' });
299
+ history.pushState(null, '', `#${heading.id}`);
300
+ });
301
+ }
302
+
303
+ function setHeadingSelfLinkScrollHandlers() {
304
+ // Clicking link inside heading scrolls smoothly to heading itself
305
+ const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
306
+ headings.forEach((heading) => {
307
+ if (!heading.id) return;
308
+
309
+ const link = heading.querySelector(`a[href^="#${heading.id}"]`);
310
+ if (link) setHeadingScrollHandler(heading, link);
311
+ })
312
+ }
313
+
314
+ /* ===== Mobile Search Modal ===== */
315
+
316
+ function hookSearchModal() {
317
+ const searchToggle = document.querySelector('#search-toggle');
318
+ const searchModal = document.querySelector('#search-modal');
319
+ const searchModalClose = document.querySelector('#search-modal-close');
320
+ const searchModalBackdrop = document.querySelector('.search-modal-backdrop');
321
+ const searchInput = document.querySelector('#search-field-mobile');
322
+ const searchResults = document.querySelector('#search-results-mobile');
323
+ const searchEmpty = document.querySelector('.search-modal-empty');
324
+
325
+ if (!searchToggle || !searchModal) return;
326
+
327
+ // Initialize search for mobile modal
328
+ const mobileSearch = createSearchInstance(searchInput, searchResults);
329
+ if (!mobileSearch) return;
330
+
331
+ // Hide empty state when there are results
332
+ const originalRenderItem = mobileSearch.renderItem;
333
+ mobileSearch.renderItem = function(result) {
334
+ if (searchEmpty) searchEmpty.style.display = 'none';
335
+ return originalRenderItem.call(this, result);
336
+ };
337
+
338
+ const openSearchModal = () => {
339
+ searchModal.hidden = false;
340
+ document.body.style.overflow = 'hidden';
341
+ // Focus input after animation
342
+ setTimeout(() => {
343
+ if (searchInput) searchInput.focus();
344
+ }, 100);
345
+ };
346
+
347
+ const closeSearchModal = () => {
348
+ searchModal.hidden = true;
349
+ document.body.style.overflow = '';
350
+ };
351
+
352
+ // Open on button click
353
+ searchToggle.addEventListener('click', openSearchModal);
354
+
355
+ // Close on close button click
356
+ if (searchModalClose) {
357
+ searchModalClose.addEventListener('click', closeSearchModal);
358
+ }
359
+
360
+ // Close on backdrop click
361
+ if (searchModalBackdrop) {
362
+ searchModalBackdrop.addEventListener('click', closeSearchModal);
363
+ }
364
+
365
+ // Close on Escape key
366
+ document.addEventListener('keydown', (e) => {
367
+ if (e.key === 'Escape' && !searchModal.hidden) {
368
+ closeSearchModal();
369
+ }
370
+ });
371
+
372
+ // Check for ?q= URL parameter on mobile and open modal
373
+ if (typeof URLSearchParams !== 'undefined') {
374
+ const urlParams = new URLSearchParams(window.location.search);
375
+ const queryParam = urlParams.get('q');
376
+ const isSmallViewport = window.matchMedia("(max-width: 1023px)").matches;
377
+
378
+ if (queryParam && isSmallViewport) {
379
+ openSearchModal();
380
+ searchInput.value = queryParam;
381
+ const navParam = urlParams.get('nav');
382
+ const autoSelect = navParam !== '0';
383
+ mobileSearch.search(queryParam, autoSelect);
384
+ }
385
+ }
386
+ }
387
+
388
+ /* ===== Code Block Copy Functionality ===== */
389
+
390
+ function createCopyButton() {
391
+ const button = document.createElement('button');
392
+ button.className = 'copy-code-button';
393
+ button.type = 'button';
394
+ button.setAttribute('aria-label', 'Copy code to clipboard');
395
+ button.setAttribute('title', 'Copy code');
396
+
397
+ // Create clipboard icon SVG
398
+ const clipboardIcon = `
399
+ <svg viewBox="0 0 24 24">
400
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
401
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
402
+ </svg>
403
+ `;
404
+
405
+ // Create checkmark icon SVG (for copied state)
406
+ const checkIcon = `
407
+ <svg viewBox="0 0 24 24">
408
+ <polyline points="20 6 9 17 4 12"></polyline>
409
+ </svg>
410
+ `;
411
+
412
+ button.innerHTML = clipboardIcon;
413
+ button.dataset.clipboardIcon = clipboardIcon;
414
+ button.dataset.checkIcon = checkIcon;
415
+
416
+ return button;
417
+ }
418
+
419
+ function wrapCodeBlocksWithCopyButton() {
420
+ // Copy buttons are generated dynamically rather than statically in rhtml templates because:
421
+ // - Code blocks are generated by RDoc's markup formatter (RDoc::Markup::ToHtml),
422
+ // not directly in rhtml templates
423
+ // - Modifying the formatter would require extending RDoc's core internals
424
+
425
+ // Find all pre elements that are not already wrapped
426
+ const preElements = document.querySelectorAll('main pre:not(.code-block-wrapper pre)');
427
+
428
+ preElements.forEach((pre) => {
429
+ // Skip if already wrapped
430
+ if (pre.parentElement.classList.contains('code-block-wrapper')) {
431
+ return;
432
+ }
433
+
434
+ // Create wrapper
435
+ const wrapper = document.createElement('div');
436
+ wrapper.className = 'code-block-wrapper';
437
+
438
+ // Insert wrapper before pre
439
+ pre.parentNode.insertBefore(wrapper, pre);
440
+
441
+ // Move pre into wrapper
442
+ wrapper.appendChild(pre);
443
+
444
+ // Create and add copy button
445
+ const copyButton = createCopyButton();
446
+ wrapper.appendChild(copyButton);
447
+
448
+ // Add click handler
449
+ copyButton.addEventListener('click', () => {
450
+ copyCodeToClipboard(pre, copyButton);
451
+ });
452
+ });
453
+ }
454
+
455
+ function copyCodeToClipboard(preElement, button) {
456
+ const code = preElement.textContent;
457
+
458
+ // Use the Clipboard API (supported by all modern browsers)
459
+ if (navigator.clipboard && navigator.clipboard.writeText) {
460
+ navigator.clipboard.writeText(code).then(() => {
461
+ showCopySuccess(button);
462
+ }).catch(() => {
463
+ alert('Failed to copy code.');
464
+ });
465
+ } else {
466
+ alert('Failed to copy code.');
467
+ }
468
+ }
469
+
470
+ function showCopySuccess(button) {
471
+ // Change icon to checkmark
472
+ button.innerHTML = button.dataset.checkIcon;
473
+ button.classList.add('copied');
474
+ button.setAttribute('aria-label', 'Copied!');
475
+ button.setAttribute('title', 'Copied!');
476
+
477
+ // Revert back after 2 seconds
478
+ setTimeout(() => {
479
+ button.innerHTML = button.dataset.clipboardIcon;
480
+ button.classList.remove('copied');
481
+ button.setAttribute('aria-label', 'Copy code to clipboard');
482
+ button.setAttribute('title', 'Copy code');
483
+ }, 2000);
484
+ }
485
+
486
+ /* ===== Initialization ===== */
487
+
488
+ document.addEventListener('DOMContentLoaded', () => {
489
+ hookSourceViews();
490
+ hookSearch();
491
+ hookFocus();
492
+ hookSidebar();
493
+ generateToc();
494
+ setHeadingSelfLinkScrollHandlers();
495
+ hookTocActiveHighlighting();
496
+ hookSearchModal();
497
+ wrapCodeBlocksWithCopyButton();
498
+ });