forked from TingjiaInFuture/allbemcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetting-started.html
More file actions
725 lines (638 loc) · 33.9 KB
/
getting-started.html
File metadata and controls
725 lines (638 loc) · 33.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Getting Started - AllBeAPI Documentation</title>
<meta name="description" content="Get started with AllBeAPI in minutes. Step-by-step guide to integrate our universal SDK into your project.">
<!-- Stylesheets -->
<link rel="stylesheet" href="../assets/css/main.css">
<link rel="stylesheet" href="../assets/css/components.css">
<link rel="stylesheet" href="../assets/css/docs.css">
<!-- Syntax highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css" id="highlight-light">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" id="highlight-dark" disabled>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar">
<div class="container">
<div class="navbar-content">
<a href="../index.html" class="navbar-brand">
<span class="brand-icon">🚀</span>
AllBeAPI
</a>
<ul class="navbar-nav">
<li><a href="index.html">Documentation</a></li>
<li><a href="getting-started.html" class="active">Getting Started</a></li>
<li><a href="api_new.html">API Reference</a></li>
<li><a href="sdk_new.html">SDK Guide</a></li>
<li><a href="https://github.com/TingjiaInFuture/allbeapi" target="_blank">GitHub</a></li>
</ul>
<div class="navbar-actions">
<button class="theme-toggle" aria-label="Toggle dark mode">
<span class="theme-icon-dark">🌙</span>
<span class="theme-icon-light">☀️</span>
</button>
</div>
</div>
</div>
</nav>
<div class="docs-layout">
<!-- Sidebar -->
<aside class="docs-sidebar">
<div class="sidebar-content">
<h3 class="sidebar-title">Getting Started</h3>
<nav class="sidebar-nav">
<ul>
<li><a href="#introduction" class="nav-link">Introduction</a></li>
<li><a href="#quick-start" class="nav-link">Quick Start</a></li>
<li><a href="#installation" class="nav-link">Installation</a></li>
<li><a href="#first-request" class="nav-link">First API Request</a></li>
<li><a href="#examples" class="nav-link">Common Examples</a></li>
<li><a href="#next-steps" class="nav-link">Next Steps</a></li>
<li><a href="#support" class="nav-link">Getting Help</a></li>
</ul>
</nav>
</div>
</aside>
<!-- Main Content -->
<main class="docs-main">
<div class="docs-content">
<!-- Header -->
<header class="docs-header">
<h1>Getting Started with AllBeAPI</h1>
<p class="docs-lead">
Welcome to AllBeAPI! This guide will get you up and running in just a few minutes.
Learn how to make your first API call and integrate AllBeAPI into your project.
</p>
<div class="getting-started-stats">
<div class="stat-card">
<div class="stat-icon">⏱️</div>
<div class="stat-info">
<div class="stat-number">5 minutes</div>
<div class="stat-label">to get started</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon">📦</div>
<div class="stat-info">
<div class="stat-number">2 SDKs</div>
<div class="stat-label">JavaScript & Python</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon">🎯</div>
<div class="stat-info">
<div class="stat-number">13+</div>
<div class="stat-label">integrated libraries</div>
</div>
</div>
</div>
</header>
<!-- Introduction -->
<section id="introduction" class="docs-section">
<h2>What is AllBeAPI?</h2>
<p>
AllBeAPI is a universal SDK that provides a unified interface to access popular third-party libraries
through simple API calls. Instead of managing multiple dependencies and learning different APIs,
you can use one consistent interface for all your needs.
</p>
<div class="intro-grid">
<div class="intro-card">
<div class="intro-icon">🎯</div>
<h3>One Interface, Many Libraries</h3>
<p>Access Markdown processing, QR code generation, code formatting, image manipulation, and more through a single API.</p>
</div>
<div class="intro-card">
<div class="intro-icon">⚡</div>
<h3>Easy Integration</h3>
<p>Get started in minutes with our JavaScript and Python SDKs, or use the REST API directly from any language.</p>
</div>
<div class="intro-card">
<div class="intro-icon">🌍</div>
<h3>Open Source</h3>
<p>Completely open source with MIT license. Self-host, contribute, or use our public API for free.</p>
</div>
</div>
</section>
<!-- Quick Start -->
<section id="quick-start" class="docs-section">
<h2>Quick Start</h2>
<p>
The fastest way to try AllBeAPI is with a simple API call. Choose your preferred method below:
</p>
<div class="quickstart-options">
<div class="quickstart-tabs">
<div class="tab-buttons">
<button class="tab-btn active" data-tab="browser">🌐 Browser</button>
<button class="tab-btn" data-tab="node">📦 Node.js</button>
<button class="tab-btn" data-tab="python">🐍 Python</button>
<button class="tab-btn" data-tab="curl">🔗 cURL</button>
</div>
<div class="tab-content">
<!-- Browser Tab -->
<div class="tab-pane active" data-tab="browser">
<h3>Try in Browser (30 seconds)</h3>
<p>Copy and paste this into an HTML file and open it in your browser:</p>
<pre><code class="language-html"><!DOCTYPE html>
<html>
<head>
<title>AllBeAPI Demo</title>
</head>
<body>
<h1>AllBeAPI Demo</h1>
<textarea id="markdown" placeholder="Enter markdown..."># Hello AllBeAPI
This is **awesome**!</textarea>
<button onclick="convert()">Convert to HTML</button>
<div id="result"></div>
<script src="https://cdn.jsdelivr.net/gh/TingjiaInFuture/allbeapi@3/SDK/JavaScript/allbeapi.js"></script>
<script>
const api = new AllBeApi();
async function convert() {
const markdown = document.getElementById('markdown').value;
const result = document.getElementById('result');
try {
const response = await api.marked.render(markdown);
result.innerHTML = '<h3>Result:</h3>' + response;
} catch (error) {
result.innerHTML = '<p style="color: red;">Error: ' + error.message + '</p>';
}
}
</script>
</body>
</html></code></pre>
</div>
<!-- Node.js Tab -->
<div class="tab-pane" data-tab="node">
<h3>Node.js Setup</h3>
<p>Create a new Node.js project and try AllBeAPI:</p>
<pre><code class="language-bash"># Create new project
mkdir allbeapi-demo
cd allbeapi-demo
npm init -y
# Download the SDK
curl -O https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/JavaScript/allbeapi.js</code></pre>
<p>Create <code>demo.js</code>:</p>
<pre><code class="language-javascript">const AllBeApi = require('./allbeapi.js');
async function demo() {
const api = new AllBeApi();
try {
// Convert Markdown to HTML
const html = await api.marked.render('# Hello AllBeAPI\nThis is **awesome**!');
console.log('HTML:', html);
// Generate QR Code
const qrBlob = await api.pythonQrcode.generateQrcode('https://allbeapi.com');
console.log('QR Code generated, size:', qrBlob.size, 'bytes');
} catch (error) {
console.error('Error:', error.message);
}
}
demo();</code></pre>
<p>Run the demo:</p>
<pre><code class="language-bash">node demo.js</code></pre>
</div>
<!-- Python Tab -->
<div class="tab-pane" data-tab="python">
<h3>Python Setup</h3>
<p>Download and try the Python SDK:</p>
<pre><code class="language-bash"># Download the SDK
curl -O https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/Python/allbeapi.py</code></pre>
<p>Create <code>demo.py</code>:</p>
<pre><code class="language-python">from allbeapi import AllBeApi
def main():
api = AllBeApi()
try:
# Convert Markdown to HTML
html = api.marked.render('# Hello AllBeAPI\nThis is **awesome**!')
print('HTML:', html)
# Generate QR Code
qr_bytes = api.python_qrcode.generate_qrcode('https://allbeapi.com')
with open('demo_qr.png', 'wb') as f:
f.write(qr_bytes)
print('QR Code saved as demo_qr.png')
except Exception as error:
print('Error:', error)
if __name__ == '__main__':
main()</code></pre>
<p>Run the demo:</p>
<pre><code class="language-bash">python demo.py</code></pre>
</div>
<!-- cURL Tab -->
<div class="tab-pane" data-tab="curl">
<h3>Direct API Calls</h3>
<p>Test AllBeAPI directly with cURL:</p>
<pre><code class="language-bash"># Convert Markdown to HTML
curl -X POST https://res.allbeapi.top/marked/render \
-H "Content-Type: application/json" \
-d '{"markdown": "# Hello AllBeAPI\nThis is **awesome**!"}'
# Generate QR Code
curl -X POST https://res.allbeapi.top/python-qrcode/generate-qrcode \
-H "Content-Type: application/json" \
-d '{"data": "https://allbeapi.com"}' \
--output demo_qr.png
# Format JavaScript code
curl -X POST https://res.allbeapi.top/prettier/format \
-H "Content-Type: application/json" \
-d '{"code": "const x=1;console.log(x);", "parser": "babel"}'</code></pre>
</div>
</div>
</div>
</div>
</section>
<!-- Installation -->
<section id="installation" class="docs-section">
<h2>Installation Options</h2>
<p>
Choose the installation method that works best for your project:
</p>
<div class="installation-grid">
<div class="install-card">
<div class="install-header">
<div class="install-icon">🌐</div>
<h3>Browser (CDN)</h3>
</div>
<div class="install-body">
<p>Include directly in your HTML for instant access:</p>
<pre><code class="language-html"><script src="https://cdn.jsdelivr.net/gh/TingjiaInFuture/allbeapi@3/SDK/JavaScript/allbeapi.js"></script></code></pre>
<div class="install-pros">
<strong>Pros:</strong> No build step, instant setup, cached by CDN
</div>
</div>
</div>
<div class="install-card">
<div class="install-header">
<div class="install-icon">📦</div>
<h3>JavaScript SDK</h3>
</div>
<div class="install-body">
<p>Download and include in your JavaScript projects:</p>
<pre><code class="language-bash"># Download JavaScript SDK
curl -O https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/JavaScript/allbeapi.js
# Or use wget
wget https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/JavaScript/allbeapi.js</code></pre>
<pre><code class="language-javascript">// Include in your project
const { AllBeApi } = require('./allbeapi.js');</code></pre>
<div class="install-pros">
<strong>Pros:</strong> Simple setup, no package manager required
</div>
</div>
</div>
<div class="install-card">
<div class="install-header">
<div class="install-icon">🐍</div>
<h3>Python SDK</h3>
</div>
<div class="install-body">
<p>Download and include in your Python projects:</p>
<pre><code class="language-bash"># Download Python SDK
curl -O https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/Python/allbeapi.py
# Or use wget
wget https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/Python/allbeapi.py</code></pre>
<pre><code class="language-python">from allbeapi import AllBeApi</code></pre>
<div class="install-pros">
<strong>Pros:</strong> Simple setup, no package manager required
</div>
</div>
</div>
<div class="install-card">
<div class="install-header">
<div class="install-icon">📁</div>
<h3>Direct Download</h3>
</div>
<div class="install-body">
<p>Download SDK files directly for maximum control:</p>
<pre><code class="language-bash"># Download JavaScript SDK
curl -O https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/JavaScript/allbeapi.js
# Download Python SDK
curl -O https://raw.githubusercontent.com/TingjiaInFuture/allbeapi/main/SDK/Python/allbeapi.py</code></pre>
<div class="download-links">
<a href="../SDK/JavaScript/allbeapi.js" class="btn btn-outline btn-sm" download>JavaScript SDK</a>
<a href="../SDK/Python/allbeapi.py" class="btn btn-outline btn-sm" download>Python SDK</a>
</div>
<div class="install-pros">
<strong>Pros:</strong> No external dependencies, full control, works offline
</div>
</div>
</div>
</div>
</section>
<!-- First Request -->
<section id="first-request" class="docs-section">
<h2>Your First API Request</h2>
<p>
Let's walk through making your first API request step by step:
</p>
<div class="step-by-step">
<div class="step">
<div class="step-number">1</div>
<div class="step-content">
<h3>Initialize the Client</h3>
<p>Create an instance of the AllBeAPI client:</p>
<div class="step-tabs">
<button class="step-tab active" data-lang="js">JavaScript</button>
<button class="step-tab" data-lang="py">Python</button>
</div>
<div class="step-code">
<pre class="step-code-block active" data-lang="js"><code class="language-javascript">const api = new AllBeApi();
// You can also specify a custom endpoint:
// const api = new AllBeApi('https://your-custom-endpoint.com');</code></pre>
<pre class="step-code-block" data-lang="py"><code class="language-python">from allbeapi import AllBeApi
api = AllBeApi()
# You can also specify a custom endpoint:
# api = AllBeApi('https://your-custom-endpoint.com')</code></pre>
</div>
</div>
</div>
<div class="step">
<div class="step-number">2</div>
<div class="step-content">
<h3>Make Your First Call</h3>
<p>Let's convert some Markdown to HTML:</p>
<div class="step-tabs">
<button class="step-tab active" data-lang="js">JavaScript</button>
<button class="step-tab" data-lang="py">Python</button>
</div>
<div class="step-code">
<pre class="step-code-block active" data-lang="js"><code class="language-javascript">const markdown = `
# Welcome to AllBeAPI
This is your **first** API call!
## Features
- Easy to use
- Powerful
- Open source
`;
try {
const html = await api.marked.render(markdown);
console.log('Success!', html);
} catch (error) {
console.error('Error:', error.message);
}</code></pre>
<pre class="step-code-block" data-lang="py"><code class="language-python">markdown = """
# Welcome to AllBeAPI
This is your **first** API call!
## Features
- Easy to use
- Powerful
- Open source
"""
try:
html = api.marked.render(markdown)
print('Success!', html)
except Exception as error:
print('Error:', error)</code></pre>
</div>
</div>
</div>
<div class="step">
<div class="step-number">3</div>
<div class="step-content">
<h3>Handle the Response</h3>
<p>AllBeAPI returns structured responses:</p>
<pre><code class="language-json">{
"success": true,
"data": {
"html": "<h1>Welcome to AllBeAPI</h1>\n<p>This is your <strong>first</strong> API call!</p>\n<h2>Features</h2>\n<ul>\n<li>Easy to use</li>\n<li>Powerful</li>\n<li>Open source</li>\n</ul>"
},
"metadata": {
"processing_time": 0.045,
"library_version": "marked@5.1.2"
}
}</code></pre>
</div>
</div>
</div>
</section>
<!-- Common Examples -->
<section id="examples" class="docs-section">
<h2>Common Use Cases</h2>
<p>
Here are some common scenarios and how to implement them with AllBeAPI:
</p>
<div class="examples-grid">
<div class="example-card">
<div class="example-header">
<div class="example-icon">📝</div>
<h3>Blog Content Processing</h3>
</div>
<div class="example-body">
<p>Convert markdown blog posts to HTML and generate social sharing QR codes:</p>
<pre><code class="language-javascript">async function processBlogPost(markdown, postUrl) {
// Convert markdown to HTML
const html = await api.marked.render(markdown);
// Generate QR code for sharing
const qrBlob = await api.pythonQrcode.generateQrcode(postUrl);
// Sanitize HTML for safety
const cleanHtml = await api.sanitizeHtml.clean(html, {
allowedTags: ['h1', 'h2', 'h3', 'p', 'strong', 'em', 'ul', 'li'],
allowedAttributes: {}
});
return { html: cleanHtml, qrCode: qrBlob };
}</code></pre>
</div>
</div>
<div class="example-card">
<div class="example-header">
<div class="example-icon">🔧</div>
<h3>Code Processing Pipeline</h3>
</div>
<div class="example-body">
<p>Format, lint, and highlight code in one pipeline:</p>
<pre><code class="language-python">def process_code(code, language='javascript'):
# Format the code
formatted = api.prettier.format(code, parser='babel')
# Lint for errors
lint_result = api.eslint.analyze(formatted)
# Add syntax highlighting
highlighted = api.pygments.highlight(formatted, language)
return {
'formatted': formatted,
'lint_errors': lint_result.get('errors', []),
'highlighted': highlighted
}</code></pre>
</div>
</div>
<div class="example-card">
<div class="example-header">
<div class="example-icon">📊</div>
<h3>Data Validation & Processing</h3>
</div>
<div class="example-body">
<p>Validate JSON data and process CSV files:</p>
<pre><code class="language-javascript">async function validateAndProcess(jsonData, csvData, schema) {
// Validate JSON against schema
const validation = await api.ajv.validate(schema, jsonData);
if (!validation.valid) {
throw new Error('Data validation failed');
}
// Parse CSV data
const parsedCsv = await api.csvParser.parse(csvData);
return {
validatedData: jsonData,
csvRecords: parsedCsv
};
}</code></pre>
</div>
</div>
</div>
</section>
<!-- Next Steps -->
<section id="next-steps" class="docs-section">
<h2>Next Steps</h2>
<p>
Now that you've made your first API call, here's what to explore next:
</p>
<div class="next-steps-grid">
<div class="next-step-card">
<div class="next-step-icon">📚</div>
<h3>Explore All APIs</h3>
<p>Discover all 13+ integrated libraries and their capabilities.</p>
<a href="api_new.html" class="btn btn-primary">API Reference</a>
</div>
<div class="next-step-card">
<div class="next-step-icon">🛠️</div>
<h3>SDK Deep Dive</h3>
<p>Learn advanced SDK features, error handling, and best practices.</p>
<a href="sdk_new.html" class="btn btn-primary">SDK Guide</a>
</div>
<div class="next-step-card">
<div class="next-step-icon">💡</div>
<h3>See Examples</h3>
<p>Browse real-world examples and integration patterns.</p>
<a href="examples.html" class="btn btn-primary">Examples</a>
</div>
<div class="next-step-card">
<div class="next-step-icon">🤝</div>
<h3>Join Community</h3>
<p>Get help, share ideas, and contribute to the project.</p>
<a href="https://github.com/TingjiaInFuture/allbeapi" target="_blank" class="btn btn-primary">GitHub</a>
</div>
</div>
</section>
<!-- Support -->
<section id="support" class="docs-section">
<h2>Getting Help</h2>
<p>
Need help or have questions? Here are the best ways to get support:
</p>
<div class="support-options">
<div class="support-card">
<div class="support-icon">📖</div>
<h3>Documentation</h3>
<p>Comprehensive guides and API reference</p>
<a href="index.html" class="support-link">Browse Docs</a>
</div>
<div class="support-card">
<div class="support-icon">💬</div>
<h3>GitHub Discussions</h3>
<p>Ask questions and discuss with the community</p>
<a href="https://github.com/TingjiaInFuture/allbeapi/discussions" target="_blank" class="support-link">Join Discussion</a>
</div>
<div class="support-card">
<div class="support-icon">🐛</div>
<h3>Issue Tracker</h3>
<p>Report bugs or request new features</p>
<a href="https://github.com/TingjiaInFuture/allbeapi/issues" target="_blank" class="support-link">Report Issue</a>
</div>
<div class="support-card">
<div class="support-icon">💡</div>
<h3>Examples Repository</h3>
<p>Browse code examples and use cases</p>
<a href="https://github.com/TingjiaInFuture/allbeapi/tree/main/examples" target="_blank" class="support-link">View Examples</a>
</div>
</div>
<div class="support-cta">
<h3>Ready to Build Something Amazing?</h3>
<p>You now have everything you need to start using AllBeAPI in your projects!</p>
<div class="cta-buttons">
<a href="api_new.html" class="btn btn-primary btn-lg">Explore APIs</a>
<a href="https://github.com/TingjiaInFuture/allbeapi" target="_blank" class="btn btn-outline btn-lg">Star on GitHub</a>
</div>
</div>
</section>
</div>
<!-- Table of Contents -->
<aside class="docs-toc">
<h4>On This Page</h4>
<nav class="toc-nav">
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#quick-start">Quick Start</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#first-request">First Request</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#next-steps">Next Steps</a></li>
<li><a href="#support">Getting Help</a></li>
</ul>
</nav>
</aside>
</main>
</div>
<!-- Scripts -->
<script src="../assets/js/main.js"></script>
<script src="../assets/js/docs.js"></script>
<script>
// Initialize syntax highlighting
hljs.highlightAll();
// Initialize theme
const savedTheme = localStorage.getItem('theme') || 'light';
document.documentElement.setAttribute('data-theme', savedTheme);
// Update highlight.js theme
function updateHighlightTheme(theme) {
const lightLink = document.getElementById('highlight-light');
const darkLink = document.getElementById('highlight-dark');
if (theme === 'dark') {
lightLink.disabled = true;
darkLink.disabled = false;
} else {
lightLink.disabled = false;
darkLink.disabled = true;
}
}
updateHighlightTheme(savedTheme);
// Theme toggle
document.querySelector('.theme-toggle')?.addEventListener('click', () => {
const currentTheme = document.documentElement.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
updateHighlightTheme(newTheme);
});
// Tab functionality for quickstart and steps
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', () => {
const container = btn.closest('.quickstart-tabs');
const targetTab = btn.dataset.tab;
// Update active button
container.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
// Update active pane
container.querySelectorAll('.tab-pane').forEach(pane => {
pane.classList.remove('active');
if (pane.dataset.tab === targetTab) {
pane.classList.add('active');
}
});
});
});
// Step tabs functionality
document.querySelectorAll('.step-tab').forEach(tab => {
tab.addEventListener('click', () => {
const container = tab.closest('.step-content');
const targetLang = tab.dataset.lang;
// Update active tab
container.querySelectorAll('.step-tab').forEach(t => t.classList.remove('active'));
tab.classList.add('active');
// Update active code block
container.querySelectorAll('.step-code-block').forEach(block => {
block.classList.remove('active');
if (block.dataset.lang === targetLang) {
block.classList.add('active');
}
});
});
});
</script>
</body>
</html>