@alliance-droid/svelte-docs-system 0.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.
- package/COMPONENTS.md +365 -0
- package/COVERAGE_REPORT.md +663 -0
- package/README.md +42 -0
- package/SEARCH_VERIFICATION.md +229 -0
- package/TEST_SUMMARY.md +344 -0
- package/bin/init.js +821 -0
- package/docs/E2E_TESTS.md +354 -0
- package/docs/TESTING.md +754 -0
- package/docs/de/index.md +41 -0
- package/docs/en/COMPONENTS.md +443 -0
- package/docs/en/api/examples.md +100 -0
- package/docs/en/api/overview.md +69 -0
- package/docs/en/components/index.md +622 -0
- package/docs/en/config/navigation.md +505 -0
- package/docs/en/config/theme-and-colors.md +395 -0
- package/docs/en/getting-started/integration.md +406 -0
- package/docs/en/guides/common-setups.md +651 -0
- package/docs/en/index.md +243 -0
- package/docs/en/markdown.md +102 -0
- package/docs/en/routing.md +64 -0
- package/docs/en/setup.md +52 -0
- package/docs/en/troubleshooting.md +704 -0
- package/docs/es/index.md +41 -0
- package/docs/fr/index.md +41 -0
- package/docs/ja/index.md +41 -0
- package/package.json +40 -0
- package/pagefind.toml +8 -0
- package/postcss.config.js +5 -0
- package/src/app.css +119 -0
- package/src/app.d.ts +13 -0
- package/src/app.html +11 -0
- package/src/lib/assets/favicon.svg +1 -0
- package/src/lib/components/APITable.svelte +120 -0
- package/src/lib/components/APITable.test.ts +153 -0
- package/src/lib/components/Breadcrumbs.svelte +85 -0
- package/src/lib/components/Breadcrumbs.test.ts +148 -0
- package/src/lib/components/Callout.svelte +60 -0
- package/src/lib/components/Callout.test.ts +100 -0
- package/src/lib/components/CodeBlock.svelte +68 -0
- package/src/lib/components/CodeBlock.test.ts +133 -0
- package/src/lib/components/DocLayout.svelte +84 -0
- package/src/lib/components/Footer.svelte +78 -0
- package/src/lib/components/Image.svelte +100 -0
- package/src/lib/components/Image.test.ts +163 -0
- package/src/lib/components/Navbar.svelte +141 -0
- package/src/lib/components/Search.svelte +248 -0
- package/src/lib/components/Sidebar.svelte +110 -0
- package/src/lib/components/Tabs.svelte +48 -0
- package/src/lib/components/Tabs.test.ts +102 -0
- package/src/lib/config.test.ts +140 -0
- package/src/lib/config.ts +179 -0
- package/src/lib/configIntegration.test.ts +272 -0
- package/src/lib/configLoader.ts +231 -0
- package/src/lib/configParser.test.ts +217 -0
- package/src/lib/configParser.ts +234 -0
- package/src/lib/index.ts +34 -0
- package/src/lib/integration.test.ts +426 -0
- package/src/lib/navigationBuilder.test.ts +338 -0
- package/src/lib/navigationBuilder.ts +268 -0
- package/src/lib/performance.test.ts +369 -0
- package/src/lib/routing.test.ts +202 -0
- package/src/lib/routing.ts +127 -0
- package/src/lib/search-functionality.test.ts +493 -0
- package/src/lib/stores/i18n.test.ts +180 -0
- package/src/lib/stores/i18n.ts +143 -0
- package/src/lib/stores/nav.ts +36 -0
- package/src/lib/stores/search.test.ts +140 -0
- package/src/lib/stores/search.ts +162 -0
- package/src/lib/stores/theme.ts +59 -0
- package/src/lib/stores/version.test.ts +139 -0
- package/src/lib/stores/version.ts +111 -0
- package/src/lib/themeCustomization.test.ts +223 -0
- package/src/lib/themeCustomization.ts +212 -0
- package/src/lib/utils/highlight.test.ts +136 -0
- package/src/lib/utils/highlight.ts +100 -0
- package/src/lib/utils/index.ts +7 -0
- package/src/lib/utils/markdown.test.ts +357 -0
- package/src/lib/utils/markdown.ts +77 -0
- package/src/routes/+layout.server.ts +1 -0
- package/src/routes/+layout.svelte +28 -0
- package/src/routes/+page.svelte +165 -0
- package/static/robots.txt +3 -0
- package/svelte.config.js +18 -0
- package/tailwind.config.ts +55 -0
- package/template-starter/.github/workflows/build.yml +40 -0
- package/template-starter/.github/workflows/deploy-github-pages.yml +47 -0
- package/template-starter/.github/workflows/deploy-netlify.yml +41 -0
- package/template-starter/.github/workflows/deploy-vercel.yml +64 -0
- package/template-starter/NPM-PACKAGE-SETUP.md +233 -0
- package/template-starter/README.md +320 -0
- package/template-starter/docs/_config.json +39 -0
- package/template-starter/docs/api/components.md +257 -0
- package/template-starter/docs/api/overview.md +169 -0
- package/template-starter/docs/guides/configuration.md +145 -0
- package/template-starter/docs/guides/github-pages-deployment.md +254 -0
- package/template-starter/docs/guides/netlify-deployment.md +159 -0
- package/template-starter/docs/guides/vercel-deployment.md +131 -0
- package/template-starter/docs/index.md +49 -0
- package/template-starter/docs/setup.md +149 -0
- package/template-starter/package.json +31 -0
- package/template-starter/pagefind.toml +3 -0
- package/template-starter/postcss.config.js +5 -0
- package/template-starter/src/app.css +34 -0
- package/template-starter/src/app.d.ts +13 -0
- package/template-starter/src/app.html +11 -0
- package/template-starter/src/lib/components/APITable.svelte +120 -0
- package/template-starter/src/lib/components/APITable.test.ts +19 -0
- package/template-starter/src/lib/components/Breadcrumbs.svelte +85 -0
- package/template-starter/src/lib/components/Breadcrumbs.test.ts +19 -0
- package/template-starter/src/lib/components/Callout.svelte +60 -0
- package/template-starter/src/lib/components/Callout.test.ts +16 -0
- package/template-starter/src/lib/components/CodeBlock.svelte +68 -0
- package/template-starter/src/lib/components/CodeBlock.test.ts +12 -0
- package/template-starter/src/lib/components/DocLayout.svelte +84 -0
- package/template-starter/src/lib/components/Footer.svelte +78 -0
- package/template-starter/src/lib/components/Image.svelte +100 -0
- package/template-starter/src/lib/components/Image.test.ts +15 -0
- package/template-starter/src/lib/components/Navbar.svelte +141 -0
- package/template-starter/src/lib/components/Search.svelte +248 -0
- package/template-starter/src/lib/components/Sidebar.svelte +110 -0
- package/template-starter/src/lib/components/Tabs.svelte +48 -0
- package/template-starter/src/lib/components/Tabs.test.ts +17 -0
- package/template-starter/src/lib/index.ts +15 -0
- package/template-starter/src/routes/+layout.svelte +28 -0
- package/template-starter/src/routes/+page.svelte +92 -0
- package/template-starter/svelte.config.js +17 -0
- package/template-starter/tailwind.config.ts +17 -0
- package/template-starter/tsconfig.json +13 -0
- package/template-starter/vite.config.ts +6 -0
- package/tests/e2e/example.spec.ts +345 -0
- package/tsconfig.json +20 -0
- package/vite.config.ts +6 -0
- package/vitest.config.ts +34 -0
- package/vitest.setup.ts +21 -0
package/docs/de/index.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dokumentationsstartseite
|
|
3
|
+
description: Willkommen beim SvelteKit-Dokumentationssystem
|
|
4
|
+
author: Andrew
|
|
5
|
+
date: 2026-02-05
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Willkommen beim Dokumentationssystem
|
|
9
|
+
|
|
10
|
+
Dies ist die Startseite Ihrer Dokumentationswebsite. Sie demonstriert das Markdown-Routingsystem in Aktion.
|
|
11
|
+
|
|
12
|
+
## Funktionen
|
|
13
|
+
|
|
14
|
+
- **Automatisches Routing** von Markdown-Dateien
|
|
15
|
+
- **Unterstützung verschachtelter Pfade** (Dokumente in Ordnern organisieren)
|
|
16
|
+
- **Frontmatter-Metadaten** (Titel, Autor, Datum)
|
|
17
|
+
- **Professionelle Formatierung** sofort einsatzbereit
|
|
18
|
+
- **Einfach zu personalisieren** und zu erweitern
|
|
19
|
+
|
|
20
|
+
## Erste Schritte
|
|
21
|
+
|
|
22
|
+
Schauen Sie sich die [Installationsanleitung](/docs/de/setup) an, um zu beginnen.
|
|
23
|
+
|
|
24
|
+
## Projektstruktur
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
docs/
|
|
28
|
+
├── index.md (Diese Datei)
|
|
29
|
+
├── setup.md (Erste-Schritte-Anleitung)
|
|
30
|
+
├── routing.md (Funktionsweise des Routings)
|
|
31
|
+
├── api/
|
|
32
|
+
│ ├── overview.md (API-Übersicht)
|
|
33
|
+
│ └── examples.md (API-Beispiele)
|
|
34
|
+
└── guides/
|
|
35
|
+
└── advanced.md (Fortgeschrittene Themen)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Jede Markdown-Datei wird automatisch zu einer Route:
|
|
39
|
+
- `docs/setup.md` → `/docs/de/setup`
|
|
40
|
+
- `docs/api/overview.md` → `/docs/de/api/overview`
|
|
41
|
+
- `docs/guides/advanced.md` → `/docs/de/guides/advanced`
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
# Core Documentation Components
|
|
2
|
+
|
|
3
|
+
A collection of reusable Svelte 5 components for building beautiful, accessible documentation sites.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Callout](#callout) - Alert boxes with variants
|
|
10
|
+
2. [Tabs](#tabs) - Switchable content panels
|
|
11
|
+
3. [CodeBlock](#codeblock) - Code display with copy button
|
|
12
|
+
4. [Image](#image) - Responsive images with captions
|
|
13
|
+
5. [APITable](#apitable) - API reference tables
|
|
14
|
+
6. [Breadcrumbs](#breadcrumbs) - Navigation breadcrumbs
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Callout
|
|
19
|
+
|
|
20
|
+
**Component:** `<Callout />`
|
|
21
|
+
|
|
22
|
+
Alert/notification boxes for highlighting important information.
|
|
23
|
+
|
|
24
|
+
### Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
27
|
+
|------|------|---------|-------------|
|
|
28
|
+
| `variant` | `'info' \| 'warning' \| 'success' \| 'error'` | `'info'` | Visual style variant |
|
|
29
|
+
| `title` | `string` | `undefined` | Optional callout title |
|
|
30
|
+
| `children` | `Snippet` | required | Content to display |
|
|
31
|
+
|
|
32
|
+
### Variants
|
|
33
|
+
|
|
34
|
+
- **info** (blue) - General information and tips
|
|
35
|
+
- **warning** (amber) - Caution messages
|
|
36
|
+
- **success** (green) - Positive/successful messages
|
|
37
|
+
- **error** (red) - Error or critical messages
|
|
38
|
+
|
|
39
|
+
### Usage Examples
|
|
40
|
+
|
|
41
|
+
```svelte
|
|
42
|
+
<Callout variant="info" title="Note">
|
|
43
|
+
This is informational content.
|
|
44
|
+
</Callout>
|
|
45
|
+
|
|
46
|
+
<Callout variant="warning" title="Warning">
|
|
47
|
+
Be careful with this setting.
|
|
48
|
+
</Callout>
|
|
49
|
+
|
|
50
|
+
<Callout variant="success" title="Success">
|
|
51
|
+
Operation completed successfully!
|
|
52
|
+
</Callout>
|
|
53
|
+
|
|
54
|
+
<Callout variant="error" title="Error">
|
|
55
|
+
Something went wrong. Please try again.
|
|
56
|
+
</Callout>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Styling
|
|
60
|
+
|
|
61
|
+
- Default background and border colors based on variant
|
|
62
|
+
- Dark mode support with `dark:` classes
|
|
63
|
+
- Font Awesome icons for visual indicators
|
|
64
|
+
- Responsive padding and layout
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Tabs
|
|
69
|
+
|
|
70
|
+
**Component:** `<Tabs />`
|
|
71
|
+
|
|
72
|
+
Display multiple content panels with tab navigation.
|
|
73
|
+
|
|
74
|
+
### Props
|
|
75
|
+
|
|
76
|
+
| Prop | Type | Default | Description |
|
|
77
|
+
|------|------|---------|-------------|
|
|
78
|
+
| `items` | `TabItem[]` | required | Array of tab definitions |
|
|
79
|
+
| `defaultIndex` | `number` | `0` | Initially active tab index |
|
|
80
|
+
|
|
81
|
+
### TabItem Type
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
interface TabItem {
|
|
85
|
+
label: string; // Tab button label
|
|
86
|
+
content?: string; // HTML content (optional)
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Usage Examples
|
|
91
|
+
|
|
92
|
+
```svelte
|
|
93
|
+
<script>
|
|
94
|
+
const tabs = [
|
|
95
|
+
{ label: 'JavaScript', content: '<code>const x = 42;</code>' },
|
|
96
|
+
{ label: 'Python', content: '<code>x = 42</code>' },
|
|
97
|
+
{ label: 'Rust', content: '<code>let x = 42;</code>' }
|
|
98
|
+
];
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<Tabs items={tabs} defaultIndex={0} />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Features
|
|
105
|
+
|
|
106
|
+
- Click to switch between tabs
|
|
107
|
+
- Active tab highlighting
|
|
108
|
+
- HTML content rendering
|
|
109
|
+
- Smooth transitions
|
|
110
|
+
- Keyboard accessible
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## CodeBlock
|
|
115
|
+
|
|
116
|
+
**Component:** `<CodeBlock />`
|
|
117
|
+
|
|
118
|
+
Display code with syntax highlighting and copy functionality.
|
|
119
|
+
|
|
120
|
+
### Props
|
|
121
|
+
|
|
122
|
+
| Prop | Type | Default | Description |
|
|
123
|
+
|------|------|---------|-------------|
|
|
124
|
+
| `code` | `string` | required | The code content to display |
|
|
125
|
+
| `language` | `string` | `'plaintext'` | Programming language identifier |
|
|
126
|
+
| `filename` | `string` | `undefined` | Optional filename header |
|
|
127
|
+
|
|
128
|
+
### Usage Examples
|
|
129
|
+
|
|
130
|
+
```svelte
|
|
131
|
+
<CodeBlock
|
|
132
|
+
code="console.log('Hello, World!');"
|
|
133
|
+
language="javascript"
|
|
134
|
+
filename="hello.js"
|
|
135
|
+
/>
|
|
136
|
+
|
|
137
|
+
<CodeBlock
|
|
138
|
+
code={`function greet(name) {
|
|
139
|
+
return \`Hello, \${name}!\`;
|
|
140
|
+
}`}
|
|
141
|
+
language="javascript"
|
|
142
|
+
filename="greet.js"
|
|
143
|
+
/>
|
|
144
|
+
|
|
145
|
+
<CodeBlock
|
|
146
|
+
code="npm install @mypackage/docs"
|
|
147
|
+
language="bash"
|
|
148
|
+
/>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Features
|
|
152
|
+
|
|
153
|
+
- Copy-to-clipboard button
|
|
154
|
+
- Language label display
|
|
155
|
+
- Optional filename header
|
|
156
|
+
- Monospace font rendering
|
|
157
|
+
- Dark mode support
|
|
158
|
+
- Visual feedback on copy
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Image
|
|
163
|
+
|
|
164
|
+
**Component:** `<Image />`
|
|
165
|
+
|
|
166
|
+
Responsive images with caption and zoom functionality.
|
|
167
|
+
|
|
168
|
+
### Props
|
|
169
|
+
|
|
170
|
+
| Prop | Type | Default | Description |
|
|
171
|
+
|------|------|---------|-------------|
|
|
172
|
+
| `src` | `string` | required | Image source URL |
|
|
173
|
+
| `alt` | `string` | required | Alt text for accessibility |
|
|
174
|
+
| `caption` | `string` | `undefined` | Optional image caption |
|
|
175
|
+
| `width` | `number` | `undefined` | Image width (optional) |
|
|
176
|
+
| `height` | `number` | `undefined` | Image height (optional) |
|
|
177
|
+
| `zoomable` | `boolean` | `true` | Enable zoom on click |
|
|
178
|
+
|
|
179
|
+
### Usage Examples
|
|
180
|
+
|
|
181
|
+
```svelte
|
|
182
|
+
<Image
|
|
183
|
+
src="/path/to/image.jpg"
|
|
184
|
+
alt="A beautiful landscape"
|
|
185
|
+
caption="Sunset over the mountains"
|
|
186
|
+
/>
|
|
187
|
+
|
|
188
|
+
<Image
|
|
189
|
+
src="https://via.placeholder.com/600x400"
|
|
190
|
+
alt="Placeholder"
|
|
191
|
+
caption="This image can be zoomed"
|
|
192
|
+
width={600}
|
|
193
|
+
height={400}
|
|
194
|
+
zoomable={true}
|
|
195
|
+
/>
|
|
196
|
+
|
|
197
|
+
<Image
|
|
198
|
+
src="/screenshot.png"
|
|
199
|
+
alt="App screenshot"
|
|
200
|
+
zoomable={false}
|
|
201
|
+
/>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Features
|
|
205
|
+
|
|
206
|
+
- Responsive layout
|
|
207
|
+
- Click to zoom overlay
|
|
208
|
+
- Figure caption support
|
|
209
|
+
- Keyboard support (ESC to close)
|
|
210
|
+
- Accessible markup
|
|
211
|
+
- Image dimensions support
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## APITable
|
|
216
|
+
|
|
217
|
+
**Component:** `<APITable />`
|
|
218
|
+
|
|
219
|
+
Display API reference documentation in table format.
|
|
220
|
+
|
|
221
|
+
### Props
|
|
222
|
+
|
|
223
|
+
| Prop | Type | Default | Description |
|
|
224
|
+
|------|------|---------|-------------|
|
|
225
|
+
| `columns` | `Column[]` | required | Column definitions |
|
|
226
|
+
| `rows` | `Row[]` | required | Table data rows |
|
|
227
|
+
| `title` | `string` | `undefined` | Optional table title |
|
|
228
|
+
| `description` | `string` | `undefined` | Optional description |
|
|
229
|
+
|
|
230
|
+
### Column Type
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
interface Column {
|
|
234
|
+
key: string; // Data key
|
|
235
|
+
label: string; // Column header label
|
|
236
|
+
width?: string; // Optional CSS width
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Usage Examples
|
|
241
|
+
|
|
242
|
+
```svelte
|
|
243
|
+
<script>
|
|
244
|
+
const columns = [
|
|
245
|
+
{ key: 'name', label: 'Parameter Name' },
|
|
246
|
+
{ key: 'type', label: 'Type' },
|
|
247
|
+
{ key: 'required', label: 'Required' },
|
|
248
|
+
{ key: 'description', label: 'Description', width: '40%' }
|
|
249
|
+
];
|
|
250
|
+
|
|
251
|
+
const rows = [
|
|
252
|
+
{
|
|
253
|
+
name: 'apiKey',
|
|
254
|
+
type: 'string',
|
|
255
|
+
required: true,
|
|
256
|
+
description: 'Your API authentication key'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: 'timeout',
|
|
260
|
+
type: 'number',
|
|
261
|
+
required: false,
|
|
262
|
+
description: 'Request timeout in milliseconds'
|
|
263
|
+
}
|
|
264
|
+
];
|
|
265
|
+
</script>
|
|
266
|
+
|
|
267
|
+
<APITable
|
|
268
|
+
title="API Configuration"
|
|
269
|
+
description="Configuration options for the API client"
|
|
270
|
+
columns={columns}
|
|
271
|
+
rows={rows}
|
|
272
|
+
/>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Features
|
|
276
|
+
|
|
277
|
+
- Sortable column layout
|
|
278
|
+
- Alternate row colors
|
|
279
|
+
- Boolean/null value formatting
|
|
280
|
+
- Custom column widths
|
|
281
|
+
- Title and description support
|
|
282
|
+
- Empty state handling
|
|
283
|
+
- Dark mode styling
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Breadcrumbs
|
|
288
|
+
|
|
289
|
+
**Component:** `<Breadcrumbs />`
|
|
290
|
+
|
|
291
|
+
Navigation breadcrumb trail showing current page location.
|
|
292
|
+
|
|
293
|
+
### Props
|
|
294
|
+
|
|
295
|
+
| Prop | Type | Default | Description |
|
|
296
|
+
|------|------|---------|-------------|
|
|
297
|
+
| `items` | `BreadcrumbItem[]` | required | Breadcrumb items |
|
|
298
|
+
|
|
299
|
+
### BreadcrumbItem Type
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
interface BreadcrumbItem {
|
|
303
|
+
label: string; // Display text
|
|
304
|
+
href?: string; // Optional link URL
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Usage Examples
|
|
309
|
+
|
|
310
|
+
```svelte
|
|
311
|
+
<script>
|
|
312
|
+
const breadcrumbs = [
|
|
313
|
+
{ label: 'Home', href: '/' },
|
|
314
|
+
{ label: 'Docs', href: '/docs' },
|
|
315
|
+
{ label: 'Components', href: '/docs/components' },
|
|
316
|
+
{ label: 'Callout' } // Current page (no href)
|
|
317
|
+
];
|
|
318
|
+
</script>
|
|
319
|
+
|
|
320
|
+
<Breadcrumbs items={breadcrumbs} />
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Features
|
|
324
|
+
|
|
325
|
+
- Clickable navigation links
|
|
326
|
+
- Chevron separators
|
|
327
|
+
- Current page indicator
|
|
328
|
+
- Semantic HTML (`<nav>`, `<ol>`, `<li>`)
|
|
329
|
+
- Keyboard accessible
|
|
330
|
+
- Dark mode support
|
|
331
|
+
- Responsive layout
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Dark Mode Support
|
|
336
|
+
|
|
337
|
+
All components include built-in dark mode support using Tailwind CSS `dark:` variants.
|
|
338
|
+
|
|
339
|
+
To enable dark mode:
|
|
340
|
+
|
|
341
|
+
```svelte
|
|
342
|
+
<script>
|
|
343
|
+
import { theme } from '$lib/stores/theme';
|
|
344
|
+
</script>
|
|
345
|
+
|
|
346
|
+
<button onclick={() => theme.toggle()}>
|
|
347
|
+
Toggle Dark Mode
|
|
348
|
+
</button>
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Accessibility
|
|
354
|
+
|
|
355
|
+
All components are built with accessibility in mind:
|
|
356
|
+
|
|
357
|
+
- Semantic HTML structure
|
|
358
|
+
- ARIA labels and roles
|
|
359
|
+
- Keyboard navigation
|
|
360
|
+
- Focus management
|
|
361
|
+
- Color contrast compliance
|
|
362
|
+
- Alt text support
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## Installation & Export
|
|
367
|
+
|
|
368
|
+
All components are exported from `$lib`:
|
|
369
|
+
|
|
370
|
+
```svelte
|
|
371
|
+
<script>
|
|
372
|
+
import {
|
|
373
|
+
Callout,
|
|
374
|
+
Tabs,
|
|
375
|
+
CodeBlock,
|
|
376
|
+
Image,
|
|
377
|
+
APITable,
|
|
378
|
+
Breadcrumbs
|
|
379
|
+
} from '$lib';
|
|
380
|
+
</script>
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Testing
|
|
386
|
+
|
|
387
|
+
Component tests are provided in `src/lib/components/*.test.ts`:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
npm test # Run all tests
|
|
391
|
+
npm run test:coverage # Generate coverage report
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## Styling with Tailwind
|
|
397
|
+
|
|
398
|
+
Components use Tailwind CSS for styling. Customize by editing `tailwind.config.js`:
|
|
399
|
+
|
|
400
|
+
```javascript
|
|
401
|
+
export default {
|
|
402
|
+
content: ['./src/**/*.{html,js,svelte,ts}'],
|
|
403
|
+
theme: {
|
|
404
|
+
extend: {
|
|
405
|
+
colors: {
|
|
406
|
+
'doc-info': '#0ea5e9',
|
|
407
|
+
'doc-warning': '#f59e0b',
|
|
408
|
+
'doc-success': '#10b981',
|
|
409
|
+
'doc-error': '#ef4444',
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## Performance Notes
|
|
419
|
+
|
|
420
|
+
- Components are lightweight and performant
|
|
421
|
+
- No external dependencies required
|
|
422
|
+
- SSR compatible
|
|
423
|
+
- Optimized bundle size
|
|
424
|
+
- Lazy loading compatible
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## Browser Support
|
|
429
|
+
|
|
430
|
+
- Modern browsers (Chrome, Firefox, Safari, Edge)
|
|
431
|
+
- Requires Svelte 5+
|
|
432
|
+
- JavaScript required (but graceful degradation)
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## License
|
|
437
|
+
|
|
438
|
+
MIT - Free for personal and commercial use
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
**Last Updated:** February 4, 2026
|
|
443
|
+
**Version:** 1.0.0
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API Examples
|
|
3
|
+
description: Code examples for using the documentation system
|
|
4
|
+
author: Andrew
|
|
5
|
+
date: 2026-02-05
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# API Examples
|
|
9
|
+
|
|
10
|
+
Here are practical examples of using the documentation system.
|
|
11
|
+
|
|
12
|
+
## Loading a Document
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { loadMarkdownBySlug } from '$lib/markdown';
|
|
16
|
+
|
|
17
|
+
const doc = await loadMarkdownBySlug('./docs', 'setup');
|
|
18
|
+
|
|
19
|
+
console.log(doc.title); // "Setup Guide"
|
|
20
|
+
console.log(doc.slug); // "setup"
|
|
21
|
+
console.log(doc.html); // <h1>Setup Guide</h1>...
|
|
22
|
+
console.log(doc.metadata); // { title, author, date }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Scanning All Documents
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { scanDocsFolder, getSlugs } from '$lib/scanner';
|
|
29
|
+
|
|
30
|
+
const structure = await scanDocsFolder('./docs');
|
|
31
|
+
const slugs = getSlugs(structure);
|
|
32
|
+
|
|
33
|
+
slugs.forEach(slug => {
|
|
34
|
+
console.log(`Found: ${slug}`);
|
|
35
|
+
});
|
|
36
|
+
// Output:
|
|
37
|
+
// Found: index
|
|
38
|
+
// Found: setup
|
|
39
|
+
// Found: routing
|
|
40
|
+
// Found: api/overview
|
|
41
|
+
// Found: api/examples
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Building Navigation
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { scanDocsFolder, buildNavStructure } from '$lib/scanner';
|
|
48
|
+
|
|
49
|
+
const structure = await scanDocsFolder('./docs');
|
|
50
|
+
const nav = buildNavStructure(structure);
|
|
51
|
+
|
|
52
|
+
// nav contains hierarchical structure for building sidebar
|
|
53
|
+
console.log(nav);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## In a SvelteKit Route
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
// src/routes/docs/[...slug]/+page.ts
|
|
60
|
+
import { loadMarkdownBySlug } from '$lib/markdown';
|
|
61
|
+
import { error } from '@sveltejs/kit';
|
|
62
|
+
|
|
63
|
+
export async function load({ params }) {
|
|
64
|
+
const slug = params.slug || 'index';
|
|
65
|
+
const doc = await loadMarkdownBySlug('./docs', slug);
|
|
66
|
+
|
|
67
|
+
if (!doc) {
|
|
68
|
+
throw error(404, 'Page not found');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return { doc };
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Extracting Metadata
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { extractMetadata } from '$lib/markdown';
|
|
79
|
+
|
|
80
|
+
const meta = await extractMetadata('./docs/setup.md');
|
|
81
|
+
console.log(meta);
|
|
82
|
+
// { title: 'Setup Guide', author: 'Andrew', date: '2026-02-05' }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Generating Table of Contents
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { loadMarkdownBySlug, generateTableOfContents } from '$lib/markdown';
|
|
89
|
+
|
|
90
|
+
const doc = await loadMarkdownBySlug('./docs', 'setup');
|
|
91
|
+
const toc = generateTableOfContents(doc.html);
|
|
92
|
+
|
|
93
|
+
toc.forEach(item => {
|
|
94
|
+
console.log(`${' '.repeat(item.level - 2)}${item.text}`);
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Next Steps
|
|
99
|
+
|
|
100
|
+
Explore the [Routing System](/docs/routing) to learn more about how the system works.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API Overview
|
|
3
|
+
description: Overview of the documentation system API
|
|
4
|
+
author: Andrew
|
|
5
|
+
date: 2026-02-05
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# API Overview
|
|
9
|
+
|
|
10
|
+
The documentation system provides utility functions for working with markdown files and routing.
|
|
11
|
+
|
|
12
|
+
## Core Utilities
|
|
13
|
+
|
|
14
|
+
### scanDocsFolder(docsPath: string)
|
|
15
|
+
|
|
16
|
+
Scans the docs folder and returns a structure of all markdown files.
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
const structure = await scanDocsFolder('./docs');
|
|
20
|
+
// Returns: { 'setup': {...}, 'api/overview': {...} }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### loadMarkdownBySlug(docsPath: string, slug: string)
|
|
24
|
+
|
|
25
|
+
Loads and parses a markdown file by its slug.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
const doc = await loadMarkdownBySlug('./docs', 'setup');
|
|
29
|
+
// Returns: { content, html, metadata, slug, title }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### generateTableOfContents(htmlContent: string)
|
|
33
|
+
|
|
34
|
+
Generates a table of contents from rendered markdown.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const toc = generateTableOfContents(htmlContent);
|
|
38
|
+
// Returns: [{ level: 2, text: 'Setup', id: 'setup' }, ...]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Data Types
|
|
42
|
+
|
|
43
|
+
### ParsedMarkdown
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
interface ParsedMarkdown {
|
|
47
|
+
content: string; // Raw markdown
|
|
48
|
+
html: string; // Rendered HTML
|
|
49
|
+
metadata: FrontMatter; // YAML frontmatter
|
|
50
|
+
slug: string; // URL slug
|
|
51
|
+
title: string; // Page title
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### FrontMatter
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
interface FrontMatter {
|
|
59
|
+
title?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
author?: string;
|
|
62
|
+
date?: string;
|
|
63
|
+
[key: string]: any; // Custom fields
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Examples
|
|
68
|
+
|
|
69
|
+
See [API Examples](/docs/api/examples) for complete code samples.
|