@tiramisu-docs/kit 0.1.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/README.md +103 -0
- package/components.json +14 -0
- package/dist/bin/mcp.d.ts +2 -0
- package/dist/bin/mcp.js +4 -0
- package/dist/config.d.ts +99 -0
- package/dist/config.js +36 -0
- package/dist/highlight.d.ts +10 -0
- package/dist/highlight.js +93 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/lib/components/index.d.ts +16 -0
- package/dist/lib/components/index.js +18 -0
- package/dist/lib/components/tiramisu/lang-icons.d.ts +4 -0
- package/dist/lib/components/tiramisu/lang-icons.js +77 -0
- package/dist/lib/components/ui/alert/index.d.ts +5 -0
- package/dist/lib/components/ui/alert/index.js +6 -0
- package/dist/lib/components/ui/badge/index.d.ts +2 -0
- package/dist/lib/components/ui/badge/index.js +1 -0
- package/dist/lib/components/ui/button/index.d.ts +4 -0
- package/dist/lib/components/ui/button/index.js +2 -0
- package/dist/lib/components/ui/card/index.d.ts +8 -0
- package/dist/lib/components/ui/card/index.js +10 -0
- package/dist/lib/components/ui/collapsible/index.d.ts +1 -0
- package/dist/lib/components/ui/collapsible/index.js +1 -0
- package/dist/lib/components/ui/dropdown-menu/index.d.ts +18 -0
- package/dist/lib/components/ui/dropdown-menu/index.js +18 -0
- package/dist/lib/components/ui/scroll-area/index.d.ts +1 -0
- package/dist/lib/components/ui/scroll-area/index.js +1 -0
- package/dist/lib/components/ui/separator/index.d.ts +1 -0
- package/dist/lib/components/ui/separator/index.js +1 -0
- package/dist/lib/components/ui/sheet/index.d.ts +3 -0
- package/dist/lib/components/ui/sheet/index.js +3 -0
- package/dist/lib/components/ui/tabs/index.d.ts +5 -0
- package/dist/lib/components/ui/tabs/index.js +7 -0
- package/dist/lib/open-links.d.ts +22 -0
- package/dist/lib/open-links.js +33 -0
- package/dist/lib/routes/docs/[...slug]/+page.d.ts +25 -0
- package/dist/lib/routes/docs/[...slug]/+page.js +109 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +5 -0
- package/dist/mcp.d.ts +24 -0
- package/dist/mcp.js +155 -0
- package/dist/scan.d.ts +15 -0
- package/dist/scan.js +72 -0
- package/dist/seo.d.ts +63 -0
- package/dist/seo.js +160 -0
- package/dist/tiramisu-grammar.d.ts +2 -0
- package/dist/tiramisu-grammar.js +77 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.js +1 -0
- package/dist/vite.d.ts +33 -0
- package/dist/vite.js +406 -0
- package/package.json +74 -0
- package/src/config.ts +133 -0
- package/src/highlight.ts +110 -0
- package/src/index.ts +6 -0
- package/src/lib/components/DocPage.svelte +430 -0
- package/src/lib/components/DocsLayout.svelte +145 -0
- package/src/lib/components/Footer.svelte +26 -0
- package/src/lib/components/Navbar.svelte +117 -0
- package/src/lib/components/PageFooter.svelte +63 -0
- package/src/lib/components/PrevNextNav.svelte +83 -0
- package/src/lib/components/SearchDialog.svelte +130 -0
- package/src/lib/components/Sidebar.svelte +237 -0
- package/src/lib/components/TableOfContents.svelte +50 -0
- package/src/lib/components/TopBar.svelte +407 -0
- package/src/lib/components/index.ts +19 -0
- package/src/lib/components/tiramisu/Accordion.svelte +16 -0
- package/src/lib/components/tiramisu/Badge.svelte +16 -0
- package/src/lib/components/tiramisu/Callout.svelte +26 -0
- package/src/lib/components/tiramisu/CodeBlock.svelte +56 -0
- package/src/lib/components/tiramisu/CodeTabs.svelte +123 -0
- package/src/lib/components/tiramisu/Demo.svelte +15 -0
- package/src/lib/components/tiramisu/FileTree.svelte +67 -0
- package/src/lib/components/tiramisu/MathBlock.svelte +26 -0
- package/src/lib/components/tiramisu/Mermaid.svelte +30 -0
- package/src/lib/components/tiramisu/NavCard.svelte +49 -0
- package/src/lib/components/tiramisu/Steps.svelte +60 -0
- package/src/lib/components/tiramisu/Tabs.svelte +87 -0
- package/src/lib/components/tiramisu/ZoomImage.svelte +114 -0
- package/src/lib/components/tiramisu/lang-icons.ts +81 -0
- package/src/lib/open-links.ts +50 -0
- package/src/lib/routes/docs/[...slug]/+page.svelte +26 -0
- package/src/lib/routes/docs/[...slug]/+page.ts +117 -0
- package/src/lib/styles/theme.css +222 -0
- package/src/lib/utils.ts +10 -0
- package/src/mcp.ts +180 -0
- package/src/scan.ts +92 -0
- package/src/seo.ts +193 -0
- package/src/tiramisu-grammar.ts +80 -0
- package/src/types.ts +71 -0
- package/src/virtual.d.ts +11 -0
- package/src/vite.ts +478 -0
- package/tests/config.test.ts +60 -0
- package/tests/mcp.test.ts +116 -0
- package/tests/scan.test.ts +48 -0
- package/tests/seo.test.ts +174 -0
- package/tests/vite.test.ts +283 -0
- package/tsconfig.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# @tiramisu-docs/kit
|
|
2
|
+
|
|
3
|
+
Vite plugin, layout components, and theme for building documentation sites with Tiramisu. Provides everything needed to turn a directory of `.tiramisu` files into a fully-featured docs site.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @tiramisu-docs/kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependencies:** `svelte ^5.0.0`, `@sveltejs/kit ^2.0.0`, `vite >=6.0.0`
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
### Vite Plugin
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import { tiramisuPlugin } from "@tiramisu-docs/kit/vite"
|
|
20
|
+
|
|
21
|
+
export default defineConfig({
|
|
22
|
+
plugins: [tiramisuPlugin()],
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The plugin scans `src/docs/` for `.tiramisu` files and exposes a `virtual:tiramisu-docs` module containing compiled docs, search index, and sidebar data.
|
|
27
|
+
|
|
28
|
+
### Config
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// src/lib/tiramisu.config.ts
|
|
32
|
+
import { defineConfig } from "@tiramisu-docs/kit"
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
title: "My Docs",
|
|
36
|
+
url: "https://docs.example.com",
|
|
37
|
+
mcp: true,
|
|
38
|
+
// ...
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Exports
|
|
43
|
+
|
|
44
|
+
| Entry Point | Description |
|
|
45
|
+
|-------------|-------------|
|
|
46
|
+
| `@tiramisu-docs/kit` | Config helpers (`defineConfig`, `resolveConfig`), SEO generators, types |
|
|
47
|
+
| `@tiramisu-docs/kit/vite` | Vite plugin (`tiramisuPlugin`) |
|
|
48
|
+
| `@tiramisu-docs/kit/seo` | SEO helpers (sitemap, llms.txt, JSON-LD, Open Graph) |
|
|
49
|
+
| `@tiramisu-docs/kit/mcp` | MCP HTTP handler (`handleMcpRequest`) |
|
|
50
|
+
| `@tiramisu-docs/kit/components/*` | Svelte layout and UI components |
|
|
51
|
+
| `@tiramisu-docs/kit/styles/*` | CSS stylesheets |
|
|
52
|
+
| `@tiramisu-docs/kit/types` | TypeScript type definitions |
|
|
53
|
+
| `@tiramisu-docs/kit/utils` | Utility functions (cn, class merging) |
|
|
54
|
+
|
|
55
|
+
## Components
|
|
56
|
+
|
|
57
|
+
### Layout
|
|
58
|
+
|
|
59
|
+
- **DocsLayout** — Top-level shell with navbar, sidebar, and content area
|
|
60
|
+
- **Navbar** — Top navigation bar with logo, nav links, search, and theme toggle
|
|
61
|
+
- **Sidebar** — Collapsible sidebar with groups and items
|
|
62
|
+
- **DocPage** — Page wrapper with title, description, table of contents, and SEO tags
|
|
63
|
+
- **TableOfContents** — Scrollspy heading navigation
|
|
64
|
+
|
|
65
|
+
### Tiramisu Built-ins
|
|
66
|
+
|
|
67
|
+
Svelte components that render Tiramisu built-in functions: `Callout`, `Tabs`, `CodeBlock`, `CodeTabs`, `Steps`, `Badge`, `FileTree`, `NavCard`, `ZoomImage`
|
|
68
|
+
|
|
69
|
+
## MCP Server
|
|
70
|
+
|
|
71
|
+
The kit includes a hosted MCP (Model Context Protocol) server that runs as a SvelteKit POST route:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// src/routes/mcp/+server.ts
|
|
75
|
+
import { handleMcpRequest } from "@tiramisu-docs/kit/mcp"
|
|
76
|
+
import { docs, searchIndex, sidebar } from "virtual:tiramisu-docs"
|
|
77
|
+
|
|
78
|
+
export async function POST({ request }) {
|
|
79
|
+
const body = await request.json()
|
|
80
|
+
const result = handleMcpRequest(body, { docs, searchIndex, sidebar })
|
|
81
|
+
return new Response(JSON.stringify(result), {
|
|
82
|
+
headers: { "Content-Type": "application/json" },
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Speaks JSON-RPC 2.0 with 5 tools: `search_docs`, `read_doc`, `list_pages`, `list_sections`, `get_table_of_contents`.
|
|
88
|
+
|
|
89
|
+
## SEO
|
|
90
|
+
|
|
91
|
+
Helpers for generating SEO routes:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import {
|
|
95
|
+
generateSitemap,
|
|
96
|
+
generateLlmsTxt,
|
|
97
|
+
generateLlmsFullTxt,
|
|
98
|
+
generateSkillMd,
|
|
99
|
+
buildCanonicalUrl,
|
|
100
|
+
buildPageJsonLd,
|
|
101
|
+
buildInstantOgUrl,
|
|
102
|
+
} from "@tiramisu-docs/kit/seo"
|
|
103
|
+
```
|
package/components.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://shadcn-svelte.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"tailwind": {
|
|
5
|
+
"config": "",
|
|
6
|
+
"css": "src/lib/styles/theme.css",
|
|
7
|
+
"baseColor": "zinc"
|
|
8
|
+
},
|
|
9
|
+
"aliases": {
|
|
10
|
+
"components": "$lib/components/ui",
|
|
11
|
+
"utils": "$lib/utils",
|
|
12
|
+
"lib": "$lib"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/dist/bin/mcp.js
ADDED
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export interface LogoConfig {
|
|
2
|
+
light: string;
|
|
3
|
+
dark: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SectionConfig {
|
|
6
|
+
label: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
href?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
children?: SectionConfig[];
|
|
11
|
+
}
|
|
12
|
+
export interface LocaleConfig {
|
|
13
|
+
code: string;
|
|
14
|
+
label: string;
|
|
15
|
+
flag?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface I18nConfig {
|
|
18
|
+
defaultLocale: string;
|
|
19
|
+
locales: LocaleConfig[];
|
|
20
|
+
fallback?: "default-language" | "404";
|
|
21
|
+
}
|
|
22
|
+
export interface ResolvedI18nConfig {
|
|
23
|
+
defaultLocale: string;
|
|
24
|
+
locales: LocaleConfig[];
|
|
25
|
+
fallback: "default-language" | "404";
|
|
26
|
+
}
|
|
27
|
+
export interface GitHubConfig {
|
|
28
|
+
repo: string;
|
|
29
|
+
branch?: string;
|
|
30
|
+
dir?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface FooterSocials {
|
|
33
|
+
github?: string;
|
|
34
|
+
x?: string;
|
|
35
|
+
discord?: string;
|
|
36
|
+
bluesky?: string;
|
|
37
|
+
mastodon?: string;
|
|
38
|
+
youtube?: string;
|
|
39
|
+
linkedin?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface FooterConfig {
|
|
42
|
+
socials?: FooterSocials;
|
|
43
|
+
copyright?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface InstantOgConfig {
|
|
46
|
+
siteId: string;
|
|
47
|
+
template?: string;
|
|
48
|
+
theme?: "light" | "dark";
|
|
49
|
+
accentColor?: string;
|
|
50
|
+
gradientBg?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface TiramisuDocsConfig {
|
|
53
|
+
title?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
url?: string;
|
|
56
|
+
logo?: string | LogoConfig;
|
|
57
|
+
nav?: {
|
|
58
|
+
label: string;
|
|
59
|
+
href: string;
|
|
60
|
+
}[];
|
|
61
|
+
sidebar?: {
|
|
62
|
+
groupOrder?: string[];
|
|
63
|
+
};
|
|
64
|
+
sections?: SectionConfig[];
|
|
65
|
+
i18n?: I18nConfig;
|
|
66
|
+
github?: GitHubConfig;
|
|
67
|
+
mcp?: boolean | string;
|
|
68
|
+
footer?: FooterConfig;
|
|
69
|
+
instantOg?: InstantOgConfig;
|
|
70
|
+
theme?: {
|
|
71
|
+
primary?: string;
|
|
72
|
+
radius?: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface ResolvedConfig {
|
|
76
|
+
title: string;
|
|
77
|
+
description: string;
|
|
78
|
+
url?: string;
|
|
79
|
+
logo: LogoConfig;
|
|
80
|
+
nav: {
|
|
81
|
+
label: string;
|
|
82
|
+
href: string;
|
|
83
|
+
}[];
|
|
84
|
+
sections?: SectionConfig[];
|
|
85
|
+
i18n?: ResolvedI18nConfig;
|
|
86
|
+
github?: GitHubConfig;
|
|
87
|
+
mcp?: boolean | string;
|
|
88
|
+
footer?: FooterConfig;
|
|
89
|
+
instantOg?: InstantOgConfig;
|
|
90
|
+
sidebar: {
|
|
91
|
+
groupOrder: string[];
|
|
92
|
+
};
|
|
93
|
+
theme: {
|
|
94
|
+
primary: string;
|
|
95
|
+
radius: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export declare function defineConfig(config: TiramisuDocsConfig): TiramisuDocsConfig;
|
|
99
|
+
export declare function resolveConfig(config: TiramisuDocsConfig): ResolvedConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function defineConfig(config) {
|
|
2
|
+
return config;
|
|
3
|
+
}
|
|
4
|
+
function resolveLogo(logo) {
|
|
5
|
+
if (!logo)
|
|
6
|
+
return { light: "", dark: "" };
|
|
7
|
+
if (typeof logo === "string")
|
|
8
|
+
return { light: logo, dark: logo };
|
|
9
|
+
return logo;
|
|
10
|
+
}
|
|
11
|
+
export function resolveConfig(config) {
|
|
12
|
+
return {
|
|
13
|
+
title: config.title ?? "Documentation",
|
|
14
|
+
description: config.description ?? "",
|
|
15
|
+
url: config.url?.replace(/\/+$/, ""),
|
|
16
|
+
logo: resolveLogo(config.logo),
|
|
17
|
+
nav: config.nav ?? [],
|
|
18
|
+
sections: config.sections,
|
|
19
|
+
github: config.github,
|
|
20
|
+
mcp: config.mcp,
|
|
21
|
+
footer: config.footer,
|
|
22
|
+
instantOg: config.instantOg,
|
|
23
|
+
i18n: config.i18n ? {
|
|
24
|
+
defaultLocale: config.i18n.defaultLocale,
|
|
25
|
+
locales: config.i18n.locales,
|
|
26
|
+
fallback: config.i18n.fallback ?? "default-language",
|
|
27
|
+
} : undefined,
|
|
28
|
+
sidebar: {
|
|
29
|
+
groupOrder: config.sidebar?.groupOrder ?? [],
|
|
30
|
+
},
|
|
31
|
+
theme: {
|
|
32
|
+
primary: config.theme?.primary ?? "hsl(262, 83%, 58%)",
|
|
33
|
+
radius: config.theme?.radius ?? "0.5rem",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-process compiled Svelte output to add syntax highlighting.
|
|
3
|
+
*
|
|
4
|
+
* Finds patterns like:
|
|
5
|
+
* const __code_0 = "escaped code"
|
|
6
|
+
* <CodeBlock language="typescript" code={__code_0} />
|
|
7
|
+
*
|
|
8
|
+
* Replaces the code string with Shiki-highlighted HTML.
|
|
9
|
+
*/
|
|
10
|
+
export declare function highlightCodeBlocks(svelte: string): Promise<string>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createHighlighter } from "shiki";
|
|
2
|
+
import { tiramisuGrammar } from "./tiramisu-grammar.js";
|
|
3
|
+
let highlighter = null;
|
|
4
|
+
async function getHighlighter() {
|
|
5
|
+
if (!highlighter) {
|
|
6
|
+
highlighter = await createHighlighter({
|
|
7
|
+
themes: ["github-light", "github-dark"],
|
|
8
|
+
langs: [
|
|
9
|
+
"typescript",
|
|
10
|
+
"javascript",
|
|
11
|
+
"bash",
|
|
12
|
+
"html",
|
|
13
|
+
"css",
|
|
14
|
+
"json",
|
|
15
|
+
"svelte",
|
|
16
|
+
"yaml",
|
|
17
|
+
"markdown",
|
|
18
|
+
"tsx",
|
|
19
|
+
"jsx",
|
|
20
|
+
"shell",
|
|
21
|
+
tiramisuGrammar,
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return highlighter;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Post-process compiled Svelte output to add syntax highlighting.
|
|
29
|
+
*
|
|
30
|
+
* Finds patterns like:
|
|
31
|
+
* const __code_0 = "escaped code"
|
|
32
|
+
* <CodeBlock language="typescript" code={__code_0} />
|
|
33
|
+
*
|
|
34
|
+
* Replaces the code string with Shiki-highlighted HTML.
|
|
35
|
+
*/
|
|
36
|
+
export async function highlightCodeBlocks(svelte) {
|
|
37
|
+
// Find all CodeBlock usages to map varName -> language
|
|
38
|
+
const langMap = new Map();
|
|
39
|
+
const codeBlockRegex = /<CodeBlock\s+language="([^"]*)"\s+code=\{(__code_\d+)\}\s*\/>/g;
|
|
40
|
+
let match;
|
|
41
|
+
while ((match = codeBlockRegex.exec(svelte)) !== null) {
|
|
42
|
+
langMap.set(match[2], match[1]);
|
|
43
|
+
}
|
|
44
|
+
// Find CodeTabs usages to map varName -> language
|
|
45
|
+
const codeTabsRegex = /<CodeTabs\s[^>]*codes=\{\[([^\]]*)\]\}\s+langMap=\{\[([^\]]*)\]\}\s*\/>/g;
|
|
46
|
+
while ((match = codeTabsRegex.exec(svelte)) !== null) {
|
|
47
|
+
const vars = match[1].split(/,\s*/).map(s => s.trim());
|
|
48
|
+
const langs = match[2].split(/,\s*/).map(s => s.replace(/^"|"$/g, ""));
|
|
49
|
+
for (let i = 0; i < vars.length; i++) {
|
|
50
|
+
if (vars[i] && langs[i])
|
|
51
|
+
langMap.set(vars[i], langs[i]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (langMap.size === 0)
|
|
55
|
+
return svelte;
|
|
56
|
+
const hl = await getHighlighter();
|
|
57
|
+
const loadedLangs = hl.getLoadedLanguages();
|
|
58
|
+
// Find and replace each __code_N declaration
|
|
59
|
+
const codeVarRegex = /const (__code_\d+) = ("(?:[^"\\]|\\.)*")/g;
|
|
60
|
+
let result = svelte;
|
|
61
|
+
const replacements = [];
|
|
62
|
+
while ((match = codeVarRegex.exec(svelte)) !== null) {
|
|
63
|
+
const varName = match[1];
|
|
64
|
+
const jsonStr = match[2];
|
|
65
|
+
const language = langMap.get(varName);
|
|
66
|
+
if (!language)
|
|
67
|
+
continue;
|
|
68
|
+
// Decode the JSON string, then unescape HTML entities to get raw code
|
|
69
|
+
const escapedHtml = JSON.parse(jsonStr);
|
|
70
|
+
const rawCode = escapedHtml
|
|
71
|
+
.replace(/&/g, "&")
|
|
72
|
+
.replace(/</g, "<")
|
|
73
|
+
.replace(/>/g, ">")
|
|
74
|
+
.replace(/"/g, '"');
|
|
75
|
+
const lang = loadedLangs.includes(language) ? language : "text";
|
|
76
|
+
const highlighted = hl.codeToHtml(rawCode, {
|
|
77
|
+
lang,
|
|
78
|
+
themes: { light: "github-light", dark: "github-dark" },
|
|
79
|
+
defaultColor: false,
|
|
80
|
+
});
|
|
81
|
+
// Extract just the inner content from shiki's <pre><code>...</code></pre>
|
|
82
|
+
const innerMatch = highlighted.match(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/);
|
|
83
|
+
const inner = innerMatch ? innerMatch[1] : escapedHtml;
|
|
84
|
+
replacements.push([
|
|
85
|
+
`const ${varName} = ${jsonStr}`,
|
|
86
|
+
`const ${varName} = ${JSON.stringify(inner)}`,
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
for (const [from, to] of replacements) {
|
|
90
|
+
result = result.replace(from, to);
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { defineConfig, resolveConfig } from "./config.js";
|
|
2
|
+
export type { TiramisuDocsConfig, ResolvedConfig, SectionConfig, LocaleConfig, I18nConfig, GitHubConfig, FooterConfig, FooterSocials, InstantOgConfig } from "./config.js";
|
|
3
|
+
export type { SidebarItem, SidebarSubgroup, SidebarEntry, SidebarGroup, VirtualDoc, SearchIndexEntry, ResolvedSection, LocaleData, VirtualModule } from "./types.js";
|
|
4
|
+
export { generateSitemap, generateLlmsTxt, generateLlmsFullTxt, generateSkillMd, buildCanonicalUrl, buildPageJsonLd, buildInstantOgUrl } from "./seo.js";
|
|
5
|
+
export { getOpenLinks, getGitHubEditUrl, getPageUrl } from "./lib/open-links.js";
|
|
6
|
+
export type { OpenLink, OpenLinkOptions } from "./lib/open-links.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { defineConfig, resolveConfig } from "./config.js";
|
|
2
|
+
export { generateSitemap, generateLlmsTxt, generateLlmsFullTxt, generateSkillMd, buildCanonicalUrl, buildPageJsonLd, buildInstantOgUrl } from "./seo.js";
|
|
3
|
+
export { getOpenLinks, getGitHubEditUrl, getPageUrl } from "./lib/open-links.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { default as DocsLayout } from "./DocsLayout.svelte";
|
|
2
|
+
export { default as DocPage } from "./DocPage.svelte";
|
|
3
|
+
export { default as PrevNextNav } from "./PrevNextNav.svelte";
|
|
4
|
+
export { default as Accordion } from "./tiramisu/Accordion.svelte";
|
|
5
|
+
export { default as Badge } from "./tiramisu/Badge.svelte";
|
|
6
|
+
export { default as Callout } from "./tiramisu/Callout.svelte";
|
|
7
|
+
export { default as CodeBlock } from "./tiramisu/CodeBlock.svelte";
|
|
8
|
+
export { default as CodeTabs } from "./tiramisu/CodeTabs.svelte";
|
|
9
|
+
export { default as Demo } from "./tiramisu/Demo.svelte";
|
|
10
|
+
export { default as FileTree } from "./tiramisu/FileTree.svelte";
|
|
11
|
+
export { default as MathBlock } from "./tiramisu/MathBlock.svelte";
|
|
12
|
+
export { default as Mermaid } from "./tiramisu/Mermaid.svelte";
|
|
13
|
+
export { default as NavCard } from "./tiramisu/NavCard.svelte";
|
|
14
|
+
export { default as Steps } from "./tiramisu/Steps.svelte";
|
|
15
|
+
export { default as Tabs } from "./tiramisu/Tabs.svelte";
|
|
16
|
+
export { default as ZoomImage } from "./tiramisu/ZoomImage.svelte";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Layout
|
|
2
|
+
export { default as DocsLayout } from "./DocsLayout.svelte";
|
|
3
|
+
export { default as DocPage } from "./DocPage.svelte";
|
|
4
|
+
export { default as PrevNextNav } from "./PrevNextNav.svelte";
|
|
5
|
+
// Tiramisu built-ins
|
|
6
|
+
export { default as Accordion } from "./tiramisu/Accordion.svelte";
|
|
7
|
+
export { default as Badge } from "./tiramisu/Badge.svelte";
|
|
8
|
+
export { default as Callout } from "./tiramisu/Callout.svelte";
|
|
9
|
+
export { default as CodeBlock } from "./tiramisu/CodeBlock.svelte";
|
|
10
|
+
export { default as CodeTabs } from "./tiramisu/CodeTabs.svelte";
|
|
11
|
+
export { default as Demo } from "./tiramisu/Demo.svelte";
|
|
12
|
+
export { default as FileTree } from "./tiramisu/FileTree.svelte";
|
|
13
|
+
export { default as MathBlock } from "./tiramisu/MathBlock.svelte";
|
|
14
|
+
export { default as Mermaid } from "./tiramisu/Mermaid.svelte";
|
|
15
|
+
export { default as NavCard } from "./tiramisu/NavCard.svelte";
|
|
16
|
+
export { default as Steps } from "./tiramisu/Steps.svelte";
|
|
17
|
+
export { default as Tabs } from "./tiramisu/Tabs.svelte";
|
|
18
|
+
export { default as ZoomImage } from "./tiramisu/ZoomImage.svelte";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { addIcon } from "iconify-icon";
|
|
2
|
+
// Register custom tiramisu icon
|
|
3
|
+
addIcon("custom:tiramisu", {
|
|
4
|
+
body: '<rect x="3" y="16" width="18" height="3" rx="1" fill="currentColor"/><rect x="4" y="11" width="16" height="3" rx="1" fill="currentColor" opacity="0.7"/><rect x="5" y="6" width="14" height="3" rx="1" fill="currentColor" opacity="0.5"/><circle cx="8" cy="4" r="0.7" fill="currentColor" opacity="0.6"/><circle cx="12" cy="3.5" r="0.7" fill="currentColor" opacity="0.4"/><circle cx="16" cy="4" r="0.7" fill="currentColor" opacity="0.6"/>',
|
|
5
|
+
width: 24,
|
|
6
|
+
height: 24,
|
|
7
|
+
});
|
|
8
|
+
/** Map language/tool names to Iconify icon identifiers */
|
|
9
|
+
const icons = {
|
|
10
|
+
// JS/TS
|
|
11
|
+
typescript: "devicon-plain:typescript",
|
|
12
|
+
javascript: "devicon-plain:javascript",
|
|
13
|
+
tsx: "devicon-plain:typescript",
|
|
14
|
+
jsx: "devicon-plain:javascript",
|
|
15
|
+
// Web
|
|
16
|
+
html: "devicon-plain:html5",
|
|
17
|
+
css: "devicon-plain:css3",
|
|
18
|
+
svelte: "devicon-plain:svelte",
|
|
19
|
+
react: "devicon-plain:react",
|
|
20
|
+
vue: "devicon-plain:vuejs",
|
|
21
|
+
angular: "devicon-plain:angularjs",
|
|
22
|
+
// Shell
|
|
23
|
+
bash: "devicon-plain:bash",
|
|
24
|
+
shell: "devicon-plain:bash",
|
|
25
|
+
zsh: "devicon-plain:bash",
|
|
26
|
+
// Languages
|
|
27
|
+
python: "devicon-plain:python",
|
|
28
|
+
rust: "devicon-plain:rust",
|
|
29
|
+
go: "devicon-plain:go",
|
|
30
|
+
java: "devicon-plain:java",
|
|
31
|
+
csharp: "devicon-plain:csharp",
|
|
32
|
+
ruby: "devicon-plain:ruby",
|
|
33
|
+
php: "devicon-plain:php",
|
|
34
|
+
swift: "devicon-plain:swift",
|
|
35
|
+
kotlin: "devicon-plain:kotlin",
|
|
36
|
+
dart: "devicon-plain:dart",
|
|
37
|
+
c: "devicon-plain:c",
|
|
38
|
+
cpp: "devicon-plain:cplusplus",
|
|
39
|
+
// Data/Config
|
|
40
|
+
json: "devicon-plain:json",
|
|
41
|
+
yaml: "devicon-plain:yaml",
|
|
42
|
+
markdown: "devicon-plain:markdown",
|
|
43
|
+
graphql: "devicon-plain:graphql",
|
|
44
|
+
// Tools/Runtimes
|
|
45
|
+
docker: "devicon-plain:docker",
|
|
46
|
+
git: "devicon-plain:git",
|
|
47
|
+
nginx: "devicon-plain:nginx-original",
|
|
48
|
+
redis: "devicon-plain:redis",
|
|
49
|
+
postgresql: "devicon-plain:postgresql",
|
|
50
|
+
mongodb: "devicon-plain:mongodb",
|
|
51
|
+
// Package managers / runtimes
|
|
52
|
+
npm: "devicon-plain:npm",
|
|
53
|
+
yarn: "devicon-plain:yarn",
|
|
54
|
+
pnpm: "devicon-plain:pnpm",
|
|
55
|
+
bun: "devicon-plain:bun",
|
|
56
|
+
deno: "devicon-plain:denojs",
|
|
57
|
+
node: "devicon-plain:nodejs",
|
|
58
|
+
nodejs: "devicon-plain:nodejs",
|
|
59
|
+
// Custom
|
|
60
|
+
tiramisu: "custom:tiramisu",
|
|
61
|
+
};
|
|
62
|
+
// Aliases
|
|
63
|
+
icons.ts = icons.typescript;
|
|
64
|
+
icons.js = icons.javascript;
|
|
65
|
+
icons.sh = icons.bash;
|
|
66
|
+
icons.py = icons.python;
|
|
67
|
+
icons.rs = icons.rust;
|
|
68
|
+
icons.md = icons.markdown;
|
|
69
|
+
icons.yml = icons.yaml;
|
|
70
|
+
icons["c++"] = icons.cpp;
|
|
71
|
+
icons["c#"] = icons.csharp;
|
|
72
|
+
/**
|
|
73
|
+
* Get an Iconify icon name for a language, or empty string if unknown.
|
|
74
|
+
*/
|
|
75
|
+
export function getLangIcon(language) {
|
|
76
|
+
return icons[language.toLowerCase()] ?? "";
|
|
77
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from "./alert.svelte";
|
|
2
|
+
import Description from "./alert-description.svelte";
|
|
3
|
+
import Title from "./alert-title.svelte";
|
|
4
|
+
export type AlertVariant = "default" | "destructive" | "info" | "warning" | "success";
|
|
5
|
+
export { Root, Description, Title, Root as Alert, Description as AlertDescription, Title as AlertTitle, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Badge } from "./badge.svelte";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Root from "./card.svelte";
|
|
2
|
+
import Content from "./card-content.svelte";
|
|
3
|
+
import Description from "./card-description.svelte";
|
|
4
|
+
import Footer from "./card-footer.svelte";
|
|
5
|
+
import Header from "./card-header.svelte";
|
|
6
|
+
import Title from "./card-title.svelte";
|
|
7
|
+
import Action from "./card-action.svelte";
|
|
8
|
+
export { Root, Content, Description, Footer, Header, Title, Action, Root as Card, Content as CardContent, Description as CardDescription, Footer as CardFooter, Header as CardHeader, Title as CardTitle, Action as CardAction, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Root from "./card.svelte";
|
|
2
|
+
import Content from "./card-content.svelte";
|
|
3
|
+
import Description from "./card-description.svelte";
|
|
4
|
+
import Footer from "./card-footer.svelte";
|
|
5
|
+
import Header from "./card-header.svelte";
|
|
6
|
+
import Title from "./card-title.svelte";
|
|
7
|
+
import Action from "./card-action.svelte";
|
|
8
|
+
export { Root, Content, Description, Footer, Header, Title, Action,
|
|
9
|
+
//
|
|
10
|
+
Root as Card, Content as CardContent, Description as CardDescription, Footer as CardFooter, Header as CardHeader, Title as CardTitle, Action as CardAction, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Collapsible } from "./collapsible.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Collapsible } from "./collapsible.svelte";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Root from "./dropdown-menu.svelte";
|
|
2
|
+
import Sub from "./dropdown-menu-sub.svelte";
|
|
3
|
+
import CheckboxGroup from "./dropdown-menu-checkbox-group.svelte";
|
|
4
|
+
import CheckboxItem from "./dropdown-menu-checkbox-item.svelte";
|
|
5
|
+
import Content from "./dropdown-menu-content.svelte";
|
|
6
|
+
import Group from "./dropdown-menu-group.svelte";
|
|
7
|
+
import Item from "./dropdown-menu-item.svelte";
|
|
8
|
+
import Label from "./dropdown-menu-label.svelte";
|
|
9
|
+
import RadioGroup from "./dropdown-menu-radio-group.svelte";
|
|
10
|
+
import RadioItem from "./dropdown-menu-radio-item.svelte";
|
|
11
|
+
import Separator from "./dropdown-menu-separator.svelte";
|
|
12
|
+
import Shortcut from "./dropdown-menu-shortcut.svelte";
|
|
13
|
+
import Trigger from "./dropdown-menu-trigger.svelte";
|
|
14
|
+
import SubContent from "./dropdown-menu-sub-content.svelte";
|
|
15
|
+
import SubTrigger from "./dropdown-menu-sub-trigger.svelte";
|
|
16
|
+
import GroupHeading from "./dropdown-menu-group-heading.svelte";
|
|
17
|
+
import Portal from "./dropdown-menu-portal.svelte";
|
|
18
|
+
export { CheckboxGroup, CheckboxItem, Content, Portal, Root as DropdownMenu, CheckboxGroup as DropdownMenuCheckboxGroup, CheckboxItem as DropdownMenuCheckboxItem, Content as DropdownMenuContent, Portal as DropdownMenuPortal, Group as DropdownMenuGroup, Item as DropdownMenuItem, Label as DropdownMenuLabel, RadioGroup as DropdownMenuRadioGroup, RadioItem as DropdownMenuRadioItem, Separator as DropdownMenuSeparator, Shortcut as DropdownMenuShortcut, Sub as DropdownMenuSub, SubContent as DropdownMenuSubContent, SubTrigger as DropdownMenuSubTrigger, Trigger as DropdownMenuTrigger, GroupHeading as DropdownMenuGroupHeading, Group, GroupHeading, Item, Label, RadioGroup, RadioItem, Root, Separator, Shortcut, Sub, SubContent, SubTrigger, Trigger, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Root from "./dropdown-menu.svelte";
|
|
2
|
+
import Sub from "./dropdown-menu-sub.svelte";
|
|
3
|
+
import CheckboxGroup from "./dropdown-menu-checkbox-group.svelte";
|
|
4
|
+
import CheckboxItem from "./dropdown-menu-checkbox-item.svelte";
|
|
5
|
+
import Content from "./dropdown-menu-content.svelte";
|
|
6
|
+
import Group from "./dropdown-menu-group.svelte";
|
|
7
|
+
import Item from "./dropdown-menu-item.svelte";
|
|
8
|
+
import Label from "./dropdown-menu-label.svelte";
|
|
9
|
+
import RadioGroup from "./dropdown-menu-radio-group.svelte";
|
|
10
|
+
import RadioItem from "./dropdown-menu-radio-item.svelte";
|
|
11
|
+
import Separator from "./dropdown-menu-separator.svelte";
|
|
12
|
+
import Shortcut from "./dropdown-menu-shortcut.svelte";
|
|
13
|
+
import Trigger from "./dropdown-menu-trigger.svelte";
|
|
14
|
+
import SubContent from "./dropdown-menu-sub-content.svelte";
|
|
15
|
+
import SubTrigger from "./dropdown-menu-sub-trigger.svelte";
|
|
16
|
+
import GroupHeading from "./dropdown-menu-group-heading.svelte";
|
|
17
|
+
import Portal from "./dropdown-menu-portal.svelte";
|
|
18
|
+
export { CheckboxGroup, CheckboxItem, Content, Portal, Root as DropdownMenu, CheckboxGroup as DropdownMenuCheckboxGroup, CheckboxItem as DropdownMenuCheckboxItem, Content as DropdownMenuContent, Portal as DropdownMenuPortal, Group as DropdownMenuGroup, Item as DropdownMenuItem, Label as DropdownMenuLabel, RadioGroup as DropdownMenuRadioGroup, RadioItem as DropdownMenuRadioItem, Separator as DropdownMenuSeparator, Shortcut as DropdownMenuShortcut, Sub as DropdownMenuSub, SubContent as DropdownMenuSubContent, SubTrigger as DropdownMenuSubTrigger, Trigger as DropdownMenuTrigger, GroupHeading as DropdownMenuGroupHeading, Group, GroupHeading, Item, Label, RadioGroup, RadioItem, Root, Separator, Shortcut, Sub, SubContent, SubTrigger, Trigger, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ScrollArea } from "./scroll-area.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ScrollArea } from "./scroll-area.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Separator } from "./separator.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Separator } from "./separator.svelte";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from "./tabs.svelte";
|
|
2
|
+
import Content from "./tabs-content.svelte";
|
|
3
|
+
import List from "./tabs-list.svelte";
|
|
4
|
+
import Trigger from "./tabs-trigger.svelte";
|
|
5
|
+
export { Root, Content, List, Trigger, Root as Tabs, Content as TabsContent, List as TabsList, Trigger as TabsTrigger, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Root from "./tabs.svelte";
|
|
2
|
+
import Content from "./tabs-content.svelte";
|
|
3
|
+
import List from "./tabs-list.svelte";
|
|
4
|
+
import Trigger from "./tabs-trigger.svelte";
|
|
5
|
+
export { Root, Content, List, Trigger,
|
|
6
|
+
//
|
|
7
|
+
Root as Tabs, Content as TabsContent, List as TabsList, Trigger as TabsTrigger, };
|