specra-cli 0.3.0
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/LICENSE.MD +33 -0
- package/README.md +246 -0
- package/dist/api-client-VHQARPDT.js +15 -0
- package/dist/api-client-VHQARPDT.js.map +1 -0
- package/dist/chunk-5765WX4D.js +192 -0
- package/dist/chunk-5765WX4D.js.map +1 -0
- package/dist/chunk-72RDEJR2.js +94 -0
- package/dist/chunk-72RDEJR2.js.map +1 -0
- package/dist/chunk-SQ2MMFUZ.js +102 -0
- package/dist/chunk-SQ2MMFUZ.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +242 -0
- package/dist/cli.js.map +1 -0
- package/dist/deploy-V4JO2D6B.js +179 -0
- package/dist/deploy-V4JO2D6B.js.map +1 -0
- package/dist/doctor-ICALAJ4N.js +309 -0
- package/dist/doctor-ICALAJ4N.js.map +1 -0
- package/dist/login-UG3WU7DY.js +92 -0
- package/dist/login-UG3WU7DY.js.map +1 -0
- package/dist/logout-WJKHJZT6.js +24 -0
- package/dist/logout-WJKHJZT6.js.map +1 -0
- package/dist/logs-BLUJPWNO.js +77 -0
- package/dist/logs-BLUJPWNO.js.map +1 -0
- package/dist/projects-LJ57GK3D.js +49 -0
- package/dist/projects-LJ57GK3D.js.map +1 -0
- package/package.json +50 -0
- package/templates/book-docs/.env.sample +1 -0
- package/templates/book-docs/docs/v1.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v1.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v1.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v1.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v1.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v1.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v1.0.0/introduction.mdx +38 -0
- package/templates/book-docs/docs/v1.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/docs/v2.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v2.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v2.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v2.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v2.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v2.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v2.0.0/introduction.mdx +39 -0
- package/templates/book-docs/docs/v2.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/gitignore +7 -0
- package/templates/book-docs/package.json +28 -0
- package/templates/book-docs/postcss.config.mjs +8 -0
- package/templates/book-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/book-docs/public/api-specs/postman-example.json +205 -0
- package/templates/book-docs/public/api-specs/test-api.json +256 -0
- package/templates/book-docs/public/api-specs/users-api.json +264 -0
- package/templates/book-docs/specra.config.json +77 -0
- package/templates/book-docs/src/app.css +86 -0
- package/templates/book-docs/src/app.html +17 -0
- package/templates/book-docs/src/params/product.ts +7 -0
- package/templates/book-docs/src/routes/+layout.server.ts +14 -0
- package/templates/book-docs/src/routes/+layout.svelte +21 -0
- package/templates/book-docs/src/routes/+page.server.ts +9 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/book-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/book-docs/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/book-docs/static/favicon.svg +4 -0
- package/templates/book-docs/svelte.config.js +13 -0
- package/templates/book-docs/tsconfig.json +12 -0
- package/templates/book-docs/vite.config.ts +6 -0
- package/templates/jbrains-docs/.env.sample +1 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v1.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v1.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v2.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v2.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/gitignore +7 -0
- package/templates/jbrains-docs/package.json +28 -0
- package/templates/jbrains-docs/postcss.config.mjs +8 -0
- package/templates/jbrains-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/jbrains-docs/public/api-specs/postman-example.json +205 -0
- package/templates/jbrains-docs/public/api-specs/test-api.json +256 -0
- package/templates/jbrains-docs/public/api-specs/users-api.json +264 -0
- package/templates/jbrains-docs/specra.config.json +80 -0
- package/templates/jbrains-docs/src/app.css +86 -0
- package/templates/jbrains-docs/src/app.html +17 -0
- package/templates/jbrains-docs/src/params/product.ts +7 -0
- package/templates/jbrains-docs/src/routes/+layout.server.ts +14 -0
- package/templates/jbrains-docs/src/routes/+layout.svelte +21 -0
- package/templates/jbrains-docs/src/routes/+page.server.ts +9 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/jbrains-docs/static/favicon.svg +4 -0
- package/templates/jbrains-docs/svelte.config.js +13 -0
- package/templates/jbrains-docs/tsconfig.json +12 -0
- package/templates/jbrains-docs/vite.config.ts +6 -0
- package/templates/minimal/.env.sample +1 -0
- package/templates/minimal/docs/v1.0.0/about.mdx +57 -0
- package/templates/minimal/docs/v1.0.0/components/_category_.json +8 -0
- package/templates/minimal/docs/v1.0.0/components/callout.mdx +83 -0
- package/templates/minimal/docs/v1.0.0/components/code-block.mdx +103 -0
- package/templates/minimal/docs/v1.0.0/components/index.mdx +8 -0
- package/templates/minimal/docs/v1.0.0/components/tabs.mdx +92 -0
- package/templates/minimal/docs/v1.0.0/configuration.mdx +322 -0
- package/templates/minimal/docs/v1.0.0/features.mdx +197 -0
- package/templates/minimal/docs/v1.0.0/getting-started.mdx +183 -0
- package/templates/minimal/docs/v2.0.0/about.mdx +57 -0
- package/templates/minimal/docs/v2.0.0/components/_category_.json +8 -0
- package/templates/minimal/docs/v2.0.0/components/callout.mdx +83 -0
- package/templates/minimal/docs/v2.0.0/components/code-block.mdx +103 -0
- package/templates/minimal/docs/v2.0.0/components/index.mdx +8 -0
- package/templates/minimal/docs/v2.0.0/components/tabs.mdx +92 -0
- package/templates/minimal/docs/v2.0.0/configuration.mdx +322 -0
- package/templates/minimal/docs/v2.0.0/features.mdx +197 -0
- package/templates/minimal/docs/v2.0.0/getting-started.mdx +183 -0
- package/templates/minimal/gitignore +7 -0
- package/templates/minimal/package.json +29 -0
- package/templates/minimal/postcss.config.mjs +8 -0
- package/templates/minimal/specra.config.json +91 -0
- package/templates/minimal/src/app.css +86 -0
- package/templates/minimal/src/app.html +17 -0
- package/templates/minimal/src/hooks.server.ts +8 -0
- package/templates/minimal/src/params/product.ts +7 -0
- package/templates/minimal/src/routes/+error.svelte +10 -0
- package/templates/minimal/src/routes/+layout.server.ts +14 -0
- package/templates/minimal/src/routes/+layout.svelte +21 -0
- package/templates/minimal/src/routes/+page.server.ts +9 -0
- package/templates/minimal/src/routes/+page.svelte +149 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/minimal/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/minimal/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/minimal/static/api-specs/openapi-example.json +259 -0
- package/templates/minimal/static/api-specs/postman-example.json +205 -0
- package/templates/minimal/static/api-specs/test-api.json +256 -0
- package/templates/minimal/static/api-specs/users-api.json +264 -0
- package/templates/minimal/static/favicon.svg +4 -0
- package/templates/minimal/svelte.config.js +13 -0
- package/templates/minimal/tsconfig.json +12 -0
- package/templates/minimal/vite.config.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
SPECTRA_TOKEN=sk_xxx...
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Async Programming
|
|
3
|
+
description: Asynchronous data loading and dynamic content
|
|
4
|
+
sidebar_position: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page covers how the documentation platform handles asynchronous operations like data loading, content processing, and dynamic rendering.
|
|
8
|
+
|
|
9
|
+
## How Content Loading Works
|
|
10
|
+
|
|
11
|
+
Documentation pages are loaded asynchronously at build time and on navigation. The platform uses SvelteKit's server-side loading to fetch and process MDX content:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
export const load: PageServerLoad = async ({ params }) => {
|
|
15
|
+
const { version, slug } = params;
|
|
16
|
+
const doc = await getCachedDocBySlug(slug, version);
|
|
17
|
+
const allDocs = await getCachedAllDocs(version);
|
|
18
|
+
return { doc, allDocs, version, slug };
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<Callout type="info">
|
|
23
|
+
Content is cached after the first load, so subsequent navigations are nearly instant.
|
|
24
|
+
</Callout>
|
|
25
|
+
|
|
26
|
+
## Server-Side Data Flow
|
|
27
|
+
|
|
28
|
+
The data loading follows this pipeline:
|
|
29
|
+
|
|
30
|
+
<Steps>
|
|
31
|
+
<Step title="Route Matching">
|
|
32
|
+
SvelteKit matches the URL to a route pattern like `/docs/[version]/[...slug]`.
|
|
33
|
+
</Step>
|
|
34
|
+
|
|
35
|
+
<Step title="Data Loading">
|
|
36
|
+
The `+page.server.ts` load function runs, fetching the document and sidebar data.
|
|
37
|
+
</Step>
|
|
38
|
+
|
|
39
|
+
<Step title="MDX Processing">
|
|
40
|
+
The MDX content is parsed, components are resolved, and the content tree is built.
|
|
41
|
+
</Step>
|
|
42
|
+
|
|
43
|
+
<Step title="Rendering">
|
|
44
|
+
The Svelte component renders the processed content with all interactive components.
|
|
45
|
+
</Step>
|
|
46
|
+
</Steps>
|
|
47
|
+
|
|
48
|
+
## Configuration Loading
|
|
49
|
+
|
|
50
|
+
Configuration is loaded once at application startup and cached:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { initConfig, getConfig } from 'specra';
|
|
54
|
+
import specraConfig from '../../specra.config.json';
|
|
55
|
+
|
|
56
|
+
initConfig(specraConfig);
|
|
57
|
+
|
|
58
|
+
const config = getConfig(); // Cached after first call
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Version Resolution
|
|
62
|
+
|
|
63
|
+
When a user navigates to the root URL, the system resolves the active version and redirects:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
export const load: PageServerLoad = async () => {
|
|
67
|
+
const config = getConfig();
|
|
68
|
+
const activeVersion = config.site?.activeVersion || 'v1.0.0';
|
|
69
|
+
redirect(302, `/docs/${activeVersion}/home`);
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Adjacent Document Resolution
|
|
74
|
+
|
|
75
|
+
Previous and next links are computed asynchronously from the full document list:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const { previous, next } = getAdjacentDocs(slug, allDocs);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This enables linear navigation through the documentation in sidebar order.
|
|
82
|
+
|
|
83
|
+
## Table of Contents Extraction
|
|
84
|
+
|
|
85
|
+
The table of contents is extracted from heading elements in the content:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const toc = extractTableOfContents(doc.content);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This returns a structured list of headings with their depths and anchor IDs.
|
|
92
|
+
|
|
93
|
+
<Callout type="tip">
|
|
94
|
+
All these async operations are handled by the platform automatically. You only need to write MDX content — the data loading pipeline is built in.
|
|
95
|
+
</Callout>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Generics
|
|
3
|
+
description: Create reusable, type-safe documentation patterns
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Generics in the context of this documentation platform refer to creating reusable, parameterized content patterns that work across different contexts.
|
|
8
|
+
|
|
9
|
+
## Reusable Component Patterns
|
|
10
|
+
|
|
11
|
+
The built-in component library provides generic patterns that adapt to your content:
|
|
12
|
+
|
|
13
|
+
### Cards
|
|
14
|
+
|
|
15
|
+
Cards accept different props to serve different purposes:
|
|
16
|
+
|
|
17
|
+
<CardGrid cols={3}>
|
|
18
|
+
<Card icon="zap" title="Feature Card" description="Showcase a feature" />
|
|
19
|
+
<Card icon="book" title="Guide Card" description="Link to a guide" href="/docs/v1.0.0/getting-started" />
|
|
20
|
+
<Card icon="code" title="Code Card" description="Reference a code concept" />
|
|
21
|
+
</CardGrid>
|
|
22
|
+
|
|
23
|
+
### Tabs
|
|
24
|
+
|
|
25
|
+
Tabs provide generic containers for alternative content:
|
|
26
|
+
|
|
27
|
+
<Tabs defaultValue="Pattern A">
|
|
28
|
+
<Tab label="Pattern A">
|
|
29
|
+
Use tabs for installation instructions across different package managers.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install my-package
|
|
33
|
+
```
|
|
34
|
+
</Tab>
|
|
35
|
+
<Tab label="Pattern B">
|
|
36
|
+
Use tabs for code examples across different languages.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
pip install my-package
|
|
40
|
+
```
|
|
41
|
+
</Tab>
|
|
42
|
+
<Tab label="Pattern C">
|
|
43
|
+
Use tabs for platform-specific instructions.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
brew install my-package
|
|
47
|
+
```
|
|
48
|
+
</Tab>
|
|
49
|
+
</Tabs>
|
|
50
|
+
|
|
51
|
+
## Generic Page Templates
|
|
52
|
+
|
|
53
|
+
### Landing Pages
|
|
54
|
+
|
|
55
|
+
Landing pages use CardGrid to create navigation hubs:
|
|
56
|
+
|
|
57
|
+
```mdx
|
|
58
|
+
---
|
|
59
|
+
title: Section Landing
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
<CardGrid cols={2}>
|
|
63
|
+
<Card title="Topic A" description="Description" href="/path" />
|
|
64
|
+
<Card title="Topic B" description="Description" href="/path" />
|
|
65
|
+
</CardGrid>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Reference Pages
|
|
69
|
+
|
|
70
|
+
Reference pages use tables and code blocks:
|
|
71
|
+
|
|
72
|
+
```mdx
|
|
73
|
+
---
|
|
74
|
+
title: API Reference
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
| Parameter | Type | Description |
|
|
78
|
+
|-----------|------|-------------|
|
|
79
|
+
| `name` | `string` | The item name |
|
|
80
|
+
| `value` | `number` | The item value |
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Tutorial Pages
|
|
84
|
+
|
|
85
|
+
Tutorial pages use Steps for structured guidance:
|
|
86
|
+
|
|
87
|
+
```mdx
|
|
88
|
+
---
|
|
89
|
+
title: Tutorial
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
<Steps>
|
|
93
|
+
<Step title="Step 1">Instructions here</Step>
|
|
94
|
+
<Step title="Step 2">More instructions</Step>
|
|
95
|
+
</Steps>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Callout Types as Generic Patterns
|
|
99
|
+
|
|
100
|
+
Each callout type serves a specific semantic purpose:
|
|
101
|
+
|
|
102
|
+
<Callout type="info">
|
|
103
|
+
**Info** — Supplementary context that enriches understanding.
|
|
104
|
+
</Callout>
|
|
105
|
+
|
|
106
|
+
<Callout type="tip">
|
|
107
|
+
**Tip** — Practical advice that improves the reader's workflow.
|
|
108
|
+
</Callout>
|
|
109
|
+
|
|
110
|
+
<Callout type="warning">
|
|
111
|
+
**Warning** — Important caveats or potential issues to be aware of.
|
|
112
|
+
</Callout>
|
|
113
|
+
|
|
114
|
+
<Callout type="error">
|
|
115
|
+
**Error** — Critical mistakes to avoid or known issues.
|
|
116
|
+
</Callout>
|
|
117
|
+
|
|
118
|
+
## Best Practices
|
|
119
|
+
|
|
120
|
+
| Pattern | When to Use |
|
|
121
|
+
|---------|-------------|
|
|
122
|
+
| CardGrid | Hub pages, feature showcases, navigation |
|
|
123
|
+
| Tabs | Alternative content (languages, platforms, package managers) |
|
|
124
|
+
| Steps | Sequential instructions, tutorials |
|
|
125
|
+
| Callouts | Inline annotations (tips, warnings, notes) |
|
|
126
|
+
| Tables | Reference data, comparisons, specifications |
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Control Flow
|
|
3
|
+
description: Navigation flow and content organization
|
|
4
|
+
sidebar_position: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page explains how navigation flow works in the documentation system — how users move between pages and how you control the reading path.
|
|
8
|
+
|
|
9
|
+
## Sidebar Navigation
|
|
10
|
+
|
|
11
|
+
The sidebar is the primary navigation mechanism. It is automatically generated from the file and folder structure in `docs/`:
|
|
12
|
+
|
|
13
|
+
```txt
|
|
14
|
+
docs/v1.0.0/
|
|
15
|
+
├── home.mdx → Top-level page
|
|
16
|
+
├── getting-started.mdx → Top-level page
|
|
17
|
+
├── basics/
|
|
18
|
+
│ ├── _category_.json → Section configuration
|
|
19
|
+
│ ├── syntax.mdx → Page in section
|
|
20
|
+
│ ├── types.mdx → Page in section
|
|
21
|
+
│ └── control-flow.mdx → Page in section
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Pages are sorted by `sidebar_position`, then alphabetically.
|
|
25
|
+
|
|
26
|
+
## Previous/Next Navigation
|
|
27
|
+
|
|
28
|
+
At the bottom of each page, previous and next links are automatically generated based on the sidebar order. This creates a linear reading path through the documentation.
|
|
29
|
+
|
|
30
|
+
<Callout type="tip">
|
|
31
|
+
Design your `sidebar_position` values to create a logical reading flow from introduction to advanced topics.
|
|
32
|
+
</Callout>
|
|
33
|
+
|
|
34
|
+
## Tab Groups
|
|
35
|
+
|
|
36
|
+
Tab groups split the sidebar into separate tabbed sections. This is useful when documentation covers distinct but related areas:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"navigation": {
|
|
41
|
+
"tabGroups": [
|
|
42
|
+
{ "id": "language", "label": "Language" },
|
|
43
|
+
{ "id": "multiplatform", "label": "Multiplatform" }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Assign categories to tab groups in `_category_.json`:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"label": "Basics",
|
|
54
|
+
"tab_group": "language"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
<Callout type="info">
|
|
59
|
+
Pages not assigned to any tab group appear in all tabs. Use tab groups to separate conceptually different areas of documentation.
|
|
60
|
+
</Callout>
|
|
61
|
+
|
|
62
|
+
## Breadcrumbs
|
|
63
|
+
|
|
64
|
+
Breadcrumbs show the user's current position in the documentation hierarchy:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Home > Basics > Control Flow
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Enable or disable breadcrumbs in configuration:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"navigation": {
|
|
75
|
+
"showBreadcrumbs": true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Version Switching
|
|
81
|
+
|
|
82
|
+
Users can switch between documentation versions using the version selector in the header. The system attempts to navigate to the same page in the selected version.
|
|
83
|
+
|
|
84
|
+
## Linking Between Pages
|
|
85
|
+
|
|
86
|
+
Use standard Markdown links with the full path:
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
[Getting Started](/docs/v1.0.0/getting-started)
|
|
90
|
+
[Basic Syntax](/docs/v1.0.0/basics/syntax)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Cross-Version Links
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
[See v2.0.0 docs](/docs/v2.0.0/getting-started)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Cards as Navigation
|
|
100
|
+
|
|
101
|
+
Use CardGrid for hub pages that direct users to different sections:
|
|
102
|
+
|
|
103
|
+
<CardGrid cols={2}>
|
|
104
|
+
<Card icon="code" title="Basic Syntax" description="The fundamental building blocks" href="/docs/v1.0.0/basics/syntax" />
|
|
105
|
+
<Card icon="layers" title="Types & Variables" description="Type system and declarations" href="/docs/v1.0.0/basics/types" />
|
|
106
|
+
</CardGrid>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Basic Syntax
|
|
3
|
+
description: Learn the fundamental syntax and structure
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page covers the essential syntax you need to know to start writing documentation content with MDX.
|
|
8
|
+
|
|
9
|
+
## Page Structure
|
|
10
|
+
|
|
11
|
+
Every MDX page starts with frontmatter followed by content:
|
|
12
|
+
|
|
13
|
+
```mdx
|
|
14
|
+
---
|
|
15
|
+
title: Page Title
|
|
16
|
+
description: Page description
|
|
17
|
+
sidebar_position: 1
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
Your content goes here.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The frontmatter is a YAML block enclosed by `---` lines. It defines metadata about the page.
|
|
24
|
+
|
|
25
|
+
## Markdown Basics
|
|
26
|
+
|
|
27
|
+
MDX supports all standard Markdown syntax:
|
|
28
|
+
|
|
29
|
+
### Text Formatting
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
**Bold text**
|
|
33
|
+
*Italic text*
|
|
34
|
+
`Inline code`
|
|
35
|
+
~~Strikethrough~~
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Bold text**, *Italic text*, `Inline code`, ~~Strikethrough~~
|
|
39
|
+
|
|
40
|
+
### Links
|
|
41
|
+
|
|
42
|
+
```markdown
|
|
43
|
+
[Internal link](/docs/v1.0.0/getting-started)
|
|
44
|
+
[External link](https://example.com)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Images
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+

|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Code Blocks
|
|
54
|
+
|
|
55
|
+
Fenced code blocks support syntax highlighting for many languages:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
interface Document {
|
|
59
|
+
title: string;
|
|
60
|
+
content: string;
|
|
61
|
+
version: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function createDocument(title: string): Document {
|
|
65
|
+
return {
|
|
66
|
+
title,
|
|
67
|
+
content: '',
|
|
68
|
+
version: '1.0.0',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
class Document:
|
|
75
|
+
def __init__(self, title: str):
|
|
76
|
+
self.title = title
|
|
77
|
+
self.content = ""
|
|
78
|
+
self.version = "1.0.0"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Components in MDX
|
|
82
|
+
|
|
83
|
+
MDX lets you use components directly in your Markdown. Components are available globally — no imports needed:
|
|
84
|
+
|
|
85
|
+
```mdx
|
|
86
|
+
<Callout type="info">
|
|
87
|
+
This is a callout component inside MDX.
|
|
88
|
+
</Callout>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
<Callout type="info">
|
|
92
|
+
This is a callout component inside MDX.
|
|
93
|
+
</Callout>
|
|
94
|
+
|
|
95
|
+
## Headings
|
|
96
|
+
|
|
97
|
+
Use headings to create document structure. The table of contents (when enabled) is generated from H2 and H3 headings:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
## Section (H2)
|
|
101
|
+
### Subsection (H3)
|
|
102
|
+
#### Detail (H4)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
<Callout type="tip">
|
|
106
|
+
Start your content with H2 (`##`). The page title from frontmatter automatically renders as H1.
|
|
107
|
+
</Callout>
|
|
108
|
+
|
|
109
|
+
## Lists
|
|
110
|
+
|
|
111
|
+
### Unordered
|
|
112
|
+
|
|
113
|
+
- First item
|
|
114
|
+
- Second item
|
|
115
|
+
- Nested item
|
|
116
|
+
- Third item
|
|
117
|
+
|
|
118
|
+
### Ordered
|
|
119
|
+
|
|
120
|
+
1. First step
|
|
121
|
+
2. Second step
|
|
122
|
+
3. Third step
|
|
123
|
+
|
|
124
|
+
## Tables
|
|
125
|
+
|
|
126
|
+
| Column A | Column B | Column C |
|
|
127
|
+
|----------|----------|----------|
|
|
128
|
+
| Cell 1 | Cell 2 | Cell 3 |
|
|
129
|
+
| Cell 4 | Cell 5 | Cell 6 |
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Types & Variables
|
|
3
|
+
description: Understand the type system and variable declarations
|
|
4
|
+
sidebar_position: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page covers how content types and configuration variables work in the documentation platform.
|
|
8
|
+
|
|
9
|
+
## Frontmatter Types
|
|
10
|
+
|
|
11
|
+
Frontmatter fields have specific types that the system validates:
|
|
12
|
+
|
|
13
|
+
| Field | Type | Required | Description |
|
|
14
|
+
|-------|------|----------|-------------|
|
|
15
|
+
| `title` | `string` | Yes | Page title |
|
|
16
|
+
| `description` | `string` | No | SEO description |
|
|
17
|
+
| `sidebar_position` | `number` | No | Sidebar ordering |
|
|
18
|
+
| `icon` | `string` | No | Lucide icon name |
|
|
19
|
+
| `tab_group` | `string` | No | Tab group assignment |
|
|
20
|
+
| `tags` | `string[]` | No | Content tags |
|
|
21
|
+
| `draft` | `boolean` | No | Hide in production |
|
|
22
|
+
|
|
23
|
+
## Configuration Types
|
|
24
|
+
|
|
25
|
+
The `specra.config.json` file uses typed configuration:
|
|
26
|
+
|
|
27
|
+
### Theme Configuration
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
interface ThemeConfig {
|
|
31
|
+
defaultMode: 'light' | 'dark' | 'system';
|
|
32
|
+
respectPrefersColorScheme: boolean;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Example:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"theme": {
|
|
41
|
+
"defaultMode": "light",
|
|
42
|
+
"respectPrefersColorScheme": true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Navigation Configuration
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
interface NavigationConfig {
|
|
51
|
+
showSidebar: boolean;
|
|
52
|
+
collapsibleSidebar: boolean;
|
|
53
|
+
showBreadcrumbs: boolean;
|
|
54
|
+
showTableOfContents: boolean;
|
|
55
|
+
tocPosition: 'left' | 'right';
|
|
56
|
+
tocMaxDepth: number;
|
|
57
|
+
tabGroups?: TabGroup[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface TabGroup {
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
icon?: string;
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
<Callout type="info">
|
|
68
|
+
Tab groups allow you to split sidebar content into separate sections. Each category folder can be assigned to a tab group using `tab_group` in its `_category_.json`.
|
|
69
|
+
</Callout>
|
|
70
|
+
|
|
71
|
+
### Category Configuration
|
|
72
|
+
|
|
73
|
+
Categories are defined with `_category_.json` files:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
interface CategoryConfig {
|
|
77
|
+
label: string;
|
|
78
|
+
position: number;
|
|
79
|
+
collapsible: boolean;
|
|
80
|
+
collapsed: boolean;
|
|
81
|
+
icon?: string;
|
|
82
|
+
tab_group?: string;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"label": "Basics",
|
|
91
|
+
"position": 3,
|
|
92
|
+
"collapsible": true,
|
|
93
|
+
"collapsed": false,
|
|
94
|
+
"icon": "book",
|
|
95
|
+
"tab_group": "language"
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Content Variables
|
|
100
|
+
|
|
101
|
+
Environment variables can be defined in configuration and used in content:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"env": {
|
|
106
|
+
"API_URL": "https://api.example.com",
|
|
107
|
+
"VERSION": "1.0.0"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
<Callout type="tip">
|
|
113
|
+
Use environment variables for values that change between environments, like API URLs or version numbers.
|
|
114
|
+
</Callout>
|
|
115
|
+
|
|
116
|
+
## Version Variables
|
|
117
|
+
|
|
118
|
+
The documentation supports multiple versions. Each version is a folder under `docs/`:
|
|
119
|
+
|
|
120
|
+
```txt
|
|
121
|
+
docs/
|
|
122
|
+
├── v1.0.0/ # Version 1.0.0
|
|
123
|
+
├── v2.0.0/ # Version 2.0.0
|
|
124
|
+
└── next/ # Development version
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The active version is set in configuration:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"site": {
|
|
132
|
+
"activeVersion": "v1.0.0"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|