@dominikcz/greg 0.9.27
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 +397 -0
- package/bin/greg.js +241 -0
- package/bin/init.js +351 -0
- package/bin/templates/docs/getting-started.md +47 -0
- package/bin/templates/docs/index.md +11 -0
- package/bin/templates/greg.config.js +39 -0
- package/bin/templates/greg.config.ts +38 -0
- package/bin/templates/index.html +16 -0
- package/bin/templates/src/App.svelte +5 -0
- package/bin/templates/src/app.css +20 -0
- package/bin/templates/src/main.js +9 -0
- package/bin/templates/svelte.config.js +1 -0
- package/bin/templates/tsconfig.json +21 -0
- package/bin/templates/vite.config.js +23 -0
- package/docs/__partials/markdown/examples/basic.md +4 -0
- package/docs/__partials/markdown/examples/diff.md +10 -0
- package/docs/__partials/markdown/examples/focus.md +5 -0
- package/docs/__partials/markdown/examples/language-title.md +3 -0
- package/docs/__partials/markdown/examples/line-highlighting.md +5 -0
- package/docs/__partials/markdown/examples/line-numbers.md +5 -0
- package/docs/__partials/note.md +4 -0
- package/docs/guide/__shared-warning.md +4 -0
- package/docs/guide/asset-handling.md +88 -0
- package/docs/guide/deploying.md +162 -0
- package/docs/guide/getting-started.md +334 -0
- package/docs/guide/index.md +23 -0
- package/docs/guide/localization.md +290 -0
- package/docs/guide/markdown/code.md +95 -0
- package/docs/guide/markdown/components-and-mermaid.md +43 -0
- package/docs/guide/markdown/containers.md +110 -0
- package/docs/guide/markdown/header-anchors.md +34 -0
- package/docs/guide/markdown/includes.md +84 -0
- package/docs/guide/markdown/index.md +20 -0
- package/docs/guide/markdown/inline-attributes.md +21 -0
- package/docs/guide/markdown/links-and-toc.md +64 -0
- package/docs/guide/markdown/math.md +54 -0
- package/docs/guide/markdown/syntax-highlighting.md +75 -0
- package/docs/guide/routing.md +150 -0
- package/docs/guide/using-svelte.md +88 -0
- package/docs/guide/versioning.md +281 -0
- package/docs/incompatibilities.md +48 -0
- package/docs/index.md +43 -0
- package/docs/reference/badge.md +100 -0
- package/docs/reference/carbon-ads.md +46 -0
- package/docs/reference/code-group.md +126 -0
- package/docs/reference/home-page.md +232 -0
- package/docs/reference/index.md +18 -0
- package/docs/reference/markdowndocs.md +275 -0
- package/docs/reference/outline.md +79 -0
- package/docs/reference/search.md +263 -0
- package/docs/reference/steps.md +200 -0
- package/docs/reference/team-page.md +189 -0
- package/docs/reference/theme.md +150 -0
- package/fakeDocsGenerator/generate_docs.js +310 -0
- package/package.json +92 -0
- package/scripts/build-versions.js +609 -0
- package/scripts/generate-static.js +79 -0
- package/scripts/render-markdown.js +420 -0
- package/src/lib/MarkdownDocs/AiChat.svelte +936 -0
- package/src/lib/MarkdownDocs/BackToTop.svelte +68 -0
- package/src/lib/MarkdownDocs/Breadcrumb.svelte +68 -0
- package/src/lib/MarkdownDocs/DocsNavigation.svelte +149 -0
- package/src/lib/MarkdownDocs/DocsSiteHeader.svelte +758 -0
- package/src/lib/MarkdownDocs/DocsVersionSwitcher.svelte +103 -0
- package/src/lib/MarkdownDocs/MarkdownDocs.svelte +2115 -0
- package/src/lib/MarkdownDocs/MarkdownRenderer.svelte +487 -0
- package/src/lib/MarkdownDocs/Outline.svelte +238 -0
- package/src/lib/MarkdownDocs/PrevNext.svelte +115 -0
- package/src/lib/MarkdownDocs/SearchModal.svelte +1241 -0
- package/src/lib/MarkdownDocs/TreeView.svelte +32 -0
- package/src/lib/MarkdownDocs/TreeViewItem.svelte +219 -0
- package/src/lib/MarkdownDocs/VersionOutdatedNotice.svelte +72 -0
- package/src/lib/MarkdownDocs/__tests__/codeDirectives.test.js +54 -0
- package/src/lib/MarkdownDocs/__tests__/common.test.js +41 -0
- package/src/lib/MarkdownDocs/__tests__/docsExamplesLint.test.js +77 -0
- package/src/lib/MarkdownDocs/__tests__/fixtures/docs/markdown/__partial-basic.md +3 -0
- package/src/lib/MarkdownDocs/__tests__/fixtures/docs/markdown/snippet.js +9 -0
- package/src/lib/MarkdownDocs/__tests__/fixtures/includes/part.md +11 -0
- package/src/lib/MarkdownDocs/__tests__/fixtures/includes/wrapper.md +5 -0
- package/src/lib/MarkdownDocs/__tests__/fixtures/snippets/sample.js +8 -0
- package/src/lib/MarkdownDocs/__tests__/fixtures/snippets/sample.md +5 -0
- package/src/lib/MarkdownDocs/__tests__/helpers.js +67 -0
- package/src/lib/MarkdownDocs/__tests__/localeUtils.test.js +204 -0
- package/src/lib/MarkdownDocs/__tests__/markdown.test.js +704 -0
- package/src/lib/MarkdownDocs/__tests__/markdownRendererRuntime.test.js +65 -0
- package/src/lib/MarkdownDocs/__tests__/searchIndexBuilder.test.js +117 -0
- package/src/lib/MarkdownDocs/__tests__/sqliteStore.test.js +202 -0
- package/src/lib/MarkdownDocs/__tests__/useRouter.test.js +16 -0
- package/src/lib/MarkdownDocs/ai/adapters/customAdapter.js +14 -0
- package/src/lib/MarkdownDocs/ai/adapters/customAdapter.ts +43 -0
- package/src/lib/MarkdownDocs/ai/adapters/ollamaAdapter.js +81 -0
- package/src/lib/MarkdownDocs/ai/adapters/ollamaAdapter.ts +116 -0
- package/src/lib/MarkdownDocs/ai/adapters/openaiAdapter.js +92 -0
- package/src/lib/MarkdownDocs/ai/adapters/openaiAdapter.ts +137 -0
- package/src/lib/MarkdownDocs/ai/aiProvider.ts +31 -0
- package/src/lib/MarkdownDocs/ai/characters.js +52 -0
- package/src/lib/MarkdownDocs/ai/characters.ts +69 -0
- package/src/lib/MarkdownDocs/ai/chunkStore.ts +25 -0
- package/src/lib/MarkdownDocs/ai/chunker.js +85 -0
- package/src/lib/MarkdownDocs/ai/chunker.ts +135 -0
- package/src/lib/MarkdownDocs/ai/docLinker.js +26 -0
- package/src/lib/MarkdownDocs/ai/docLinker.ts +36 -0
- package/src/lib/MarkdownDocs/ai/promptBuilder.js +33 -0
- package/src/lib/MarkdownDocs/ai/promptBuilder.ts +53 -0
- package/src/lib/MarkdownDocs/ai/ragPipeline.js +54 -0
- package/src/lib/MarkdownDocs/ai/ragPipeline.ts +106 -0
- package/src/lib/MarkdownDocs/ai/stores/memoryStore.js +88 -0
- package/src/lib/MarkdownDocs/ai/stores/memoryStore.ts +112 -0
- package/src/lib/MarkdownDocs/ai/stores/sqliteStore.ts +372 -0
- package/src/lib/MarkdownDocs/ai/types.ts +71 -0
- package/src/lib/MarkdownDocs/aiServer.js +288 -0
- package/src/lib/MarkdownDocs/codeDirectives.js +191 -0
- package/src/lib/MarkdownDocs/codeFenceInfo.js +45 -0
- package/src/lib/MarkdownDocs/codeGroup.ts +46 -0
- package/src/lib/MarkdownDocs/common.ts +47 -0
- package/src/lib/MarkdownDocs/docsUtils.js +281 -0
- package/src/lib/MarkdownDocs/index.plugins.js +22 -0
- package/src/lib/MarkdownDocs/layouts/LayoutDoc.svelte +8 -0
- package/src/lib/MarkdownDocs/layouts/LayoutHome.svelte +58 -0
- package/src/lib/MarkdownDocs/layouts/LayoutPage.svelte +9 -0
- package/src/lib/MarkdownDocs/loadGregConfig.js +82 -0
- package/src/lib/MarkdownDocs/localeUtils.ts +682 -0
- package/src/lib/MarkdownDocs/markdownRendererRuntime.ts +314 -0
- package/src/lib/MarkdownDocs/mermaidThemes.js +319 -0
- package/src/lib/MarkdownDocs/navigationUtils.js +22 -0
- package/src/lib/MarkdownDocs/rehypeCodeGroup.js +326 -0
- package/src/lib/MarkdownDocs/rehypeCodeTitle.js +96 -0
- package/src/lib/MarkdownDocs/rehypeToc.js +170 -0
- package/src/lib/MarkdownDocs/remarkCodeMeta.js +22 -0
- package/src/lib/MarkdownDocs/remarkContainers.js +329 -0
- package/src/lib/MarkdownDocs/remarkCustomAnchors.js +42 -0
- package/src/lib/MarkdownDocs/remarkEscapeSvelte.js +33 -0
- package/src/lib/MarkdownDocs/remarkGlobalComponents.js +65 -0
- package/src/lib/MarkdownDocs/remarkImports.js +461 -0
- package/src/lib/MarkdownDocs/remarkImportsBrowser.js +349 -0
- package/src/lib/MarkdownDocs/remarkInlineAttrs.js +95 -0
- package/src/lib/MarkdownDocs/remarkMathToHtml.js +138 -0
- package/src/lib/MarkdownDocs/searchIndexBuilder.js +497 -0
- package/src/lib/MarkdownDocs/searchServer.js +263 -0
- package/src/lib/MarkdownDocs/treeViewTypes.ts +11 -0
- package/src/lib/MarkdownDocs/useRouter.svelte.ts +114 -0
- package/src/lib/MarkdownDocs/useSplitter.svelte.ts +33 -0
- package/src/lib/MarkdownDocs/versioningDefaults.js +20 -0
- package/src/lib/MarkdownDocs/vitePluginAiServer.js +204 -0
- package/src/lib/MarkdownDocs/vitePluginCopyDocs.js +153 -0
- package/src/lib/MarkdownDocs/vitePluginFrontmatter.js +109 -0
- package/src/lib/MarkdownDocs/vitePluginGregConfig.js +108 -0
- package/src/lib/MarkdownDocs/vitePluginSearchIndex.js +57 -0
- package/src/lib/MarkdownDocs/vitePluginSearchServer.js +190 -0
- package/src/lib/components/Badge.svelte +59 -0
- package/src/lib/components/Button.svelte +138 -0
- package/src/lib/components/CarbonAds.svelte +99 -0
- package/src/lib/components/CodeGroup.svelte +102 -0
- package/src/lib/components/Feature.svelte +209 -0
- package/src/lib/components/Features.svelte +123 -0
- package/src/lib/components/Hero.svelte +399 -0
- package/src/lib/components/Image.svelte +128 -0
- package/src/lib/components/Link.svelte +105 -0
- package/src/lib/components/SocialLink.svelte +84 -0
- package/src/lib/components/SocialLinks.svelte +33 -0
- package/src/lib/components/Steps.svelte +143 -0
- package/src/lib/components/TeamMember.svelte +273 -0
- package/src/lib/components/TeamMembers.svelte +81 -0
- package/src/lib/components/TeamPage.svelte +65 -0
- package/src/lib/components/TeamPageSection.svelte +108 -0
- package/src/lib/components/TeamPageTitle.svelte +89 -0
- package/src/lib/components/index.js +24 -0
- package/src/lib/portal/context.js +12 -0
- package/src/lib/portal/index.js +3 -0
- package/src/lib/portal/portal.svelte +14 -0
- package/src/lib/portal/slot.svelte +8 -0
- package/src/lib/scss/__code.scss +128 -0
- package/src/lib/scss/__containers.scss +99 -0
- package/src/lib/scss/__markdown.scss +447 -0
- package/src/lib/scss/__scrollbar.scss +60 -0
- package/src/lib/scss/__steps.scss +100 -0
- package/src/lib/scss/__theme.scss +238 -0
- package/src/lib/scss/__toc.scss +55 -0
- package/src/lib/scss/__utilities.scss +7 -0
- package/src/lib/scss/greg.scss +9 -0
- package/src/lib/spinner/spinner.svelte +42 -0
- package/svelte.config.js +146 -0
- package/types/index.d.ts +456 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: VitePress Incompatibilities
|
|
3
|
+
order: 999
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Greg is strongly inspired by [VitePress](https://vitepress.dev){target="_blank"} and reuses most
|
|
7
|
+
Markdown conventions. This page lists **only differences and gaps**. If a feature
|
|
8
|
+
is not mentioned here, behavior should be considered equivalent.
|
|
9
|
+
|
|
10
|
+
## Compatibility status
|
|
11
|
+
|
|
12
|
+
Greg is **compatible with VitePress at configuration level** for the supported docs/theme options
|
|
13
|
+
(including locale config).
|
|
14
|
+
|
|
15
|
+
Current incompatibilities are mostly about **runtime API** and **platform features**, not config.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Why Greg is different
|
|
19
|
+
|
|
20
|
+
Greg is optimized for **very large documentation projects** and fast SPA runtime navigation.
|
|
21
|
+
Its architecture is built around preprocessed metadata (`virtual:greg-frontmatter`),
|
|
22
|
+
predictable routing/sidebar generation, and search modes designed for large content sets.
|
|
23
|
+
|
|
24
|
+
Because of that focus, not every VitePress API/platform feature is mirrored 1:1.
|
|
25
|
+
These differences are intentional trade-offs, not config-level gaps.
|
|
26
|
+
|
|
27
|
+
For architecture and design assumptions, see:
|
|
28
|
+
|
|
29
|
+
- [MarkdownDocs Component](/reference/markdowndocs)
|
|
30
|
+
- [Search](/reference/search)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Summary
|
|
34
|
+
|
|
35
|
+
| Area | Status |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| Config compatibility | ✅ VitePress-like config supported in `greg.config.js` |
|
|
38
|
+
| Runtime API parity | ❌ No full VitePress API parity (`useData`, `useRouter`, `withBase`, `*.data.*`) |
|
|
39
|
+
| Platform features | ⚠️ Separate track (for example: sitemap, SSG adapters, build/deploy capabilities) |
|
|
40
|
+
| Rendering model | Greg is SPA-first, VitePress is SSG-first |
|
|
41
|
+
| Top navigation | ✅ Config-compatible; Greg supports deeper dropdown nesting |
|
|
42
|
+
| Markdown component model | Different by design: Greg supports Svelte in Markdown, VitePress supports Vue |
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Deployment note
|
|
46
|
+
|
|
47
|
+
Because Greg is SPA-first, configure your server to rewrite routes to `index.html`
|
|
48
|
+
(see [Deploying](/guide/deploying)).
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
title: Greg
|
|
4
|
+
order: 0
|
|
5
|
+
|
|
6
|
+
hero:
|
|
7
|
+
name: Greg
|
|
8
|
+
text: Svelte-powered documentation engine
|
|
9
|
+
tagline: Write Markdown, get beautiful documentation — hot-reloaded in milliseconds.
|
|
10
|
+
image:
|
|
11
|
+
light: /greg-logo-light.svg
|
|
12
|
+
dark: /greg-logo-dark.svg
|
|
13
|
+
alt: Greg logo
|
|
14
|
+
actions:
|
|
15
|
+
- theme: brand
|
|
16
|
+
text: Getting Started
|
|
17
|
+
link: /guide/getting-started
|
|
18
|
+
- theme: alt
|
|
19
|
+
text: Markdown Reference
|
|
20
|
+
link: /guide/markdown
|
|
21
|
+
|
|
22
|
+
features:
|
|
23
|
+
- icon: 📝
|
|
24
|
+
title: Markdown-first
|
|
25
|
+
details: Write docs in plain Markdown, enhanced with custom containers, code groups, math and more.
|
|
26
|
+
- icon: ⚡
|
|
27
|
+
title: Vite-powered
|
|
28
|
+
details: Instant server start, lightning-fast HMR, and full access to the Vite plug-in ecosystem.
|
|
29
|
+
- icon:
|
|
30
|
+
src: /svelte.svg
|
|
31
|
+
alt: Svelte
|
|
32
|
+
title: Built with Svelte 5
|
|
33
|
+
details: Use Svelte components directly inside Markdown pages. Runes-based reactivity throughout.
|
|
34
|
+
- icon: 🔍
|
|
35
|
+
title: Built-in search
|
|
36
|
+
details: Full-text fuzzy search powered by Fuse.js — no external service required.
|
|
37
|
+
- icon: 🌗
|
|
38
|
+
title: Dark / light mode
|
|
39
|
+
details: Automatic theme detection with manual override, persisted in localStorage.
|
|
40
|
+
- icon: 🧭
|
|
41
|
+
title: Auto navigation
|
|
42
|
+
details: Sidebar and routing are generated automatically from the docs folder structure.
|
|
43
|
+
---
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Badge
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Badge
|
|
6
|
+
|
|
7
|
+
The `Badge` component adds an inline status label to headings or any inline content.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
`Badge` supports two authoring styles:
|
|
12
|
+
|
|
13
|
+
- Markdown inline usage (`<Badge ... />`) in docs pages
|
|
14
|
+
- Direct component usage in `.svelte` files
|
|
15
|
+
|
|
16
|
+
### Markdown inline usage
|
|
17
|
+
|
|
18
|
+
`Badge` is available in every Markdown page without an import:
|
|
19
|
+
|
|
20
|
+
```md
|
|
21
|
+
### Title <Badge type="info" text="default" />
|
|
22
|
+
### Title <Badge type="tip" text="stable" />
|
|
23
|
+
### Title <Badge type="warning" text="beta" />
|
|
24
|
+
### Title <Badge type="danger" text="deprecated" />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Output:**
|
|
28
|
+
|
|
29
|
+
### Title <Badge type="info" text="default" />
|
|
30
|
+
### Title <Badge type="tip" text="stable" />
|
|
31
|
+
### Title <Badge type="warning" text="beta" />
|
|
32
|
+
### Title <Badge type="danger" text="deprecated" />
|
|
33
|
+
|
|
34
|
+
### Direct component usage (`.svelte`)
|
|
35
|
+
|
|
36
|
+
```svelte
|
|
37
|
+
<script>
|
|
38
|
+
import Badge from '$components/Badge.svelte';
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<h3>
|
|
42
|
+
Title <Badge type="tip" text="stable" />
|
|
43
|
+
</h3>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Output:**
|
|
47
|
+
|
|
48
|
+
Equivalent inline status badge rendered next to heading text.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Custom children
|
|
52
|
+
|
|
53
|
+
Pass content as children instead of using the `text` prop:
|
|
54
|
+
|
|
55
|
+
```md
|
|
56
|
+
### Title <Badge type="info">custom content</Badge>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Title <Badge type="info">custom content</Badge>
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Props
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
interface Props {
|
|
66
|
+
/** Text to display. Ignored when children are provided. */
|
|
67
|
+
text?: string;
|
|
68
|
+
|
|
69
|
+
/** Badge colour variant. Defaults to 'tip'. */
|
|
70
|
+
type?: 'info' | 'tip' | 'warning' | 'danger';
|
|
71
|
+
|
|
72
|
+
/** Svelte snippet — overrides `text`. */
|
|
73
|
+
children?: Snippet;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## CSS variables
|
|
79
|
+
|
|
80
|
+
Customise badge colours by overriding Greg's CSS variables:
|
|
81
|
+
|
|
82
|
+
```css
|
|
83
|
+
:root {
|
|
84
|
+
--greg-info-border: transparent;
|
|
85
|
+
--greg-info-text: var(--greg-accent);
|
|
86
|
+
--greg-info-bg: rgba(100, 108, 255, 0.08);
|
|
87
|
+
|
|
88
|
+
--greg-tip-border: transparent;
|
|
89
|
+
--greg-tip-text: #2d9e68;
|
|
90
|
+
--greg-tip-bg: rgba(66, 184, 131, 0.08);
|
|
91
|
+
|
|
92
|
+
--greg-warning-border: transparent;
|
|
93
|
+
--greg-warning-text: #7d4e00;
|
|
94
|
+
--greg-warning-bg: rgba(201, 126, 10, 0.08);
|
|
95
|
+
|
|
96
|
+
--greg-danger-border: transparent;
|
|
97
|
+
--greg-danger-text: #c81d1d;
|
|
98
|
+
--greg-danger-bg: rgba(224, 82, 82, 0.08);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Carbon Ads
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Carbon Ads
|
|
6
|
+
|
|
7
|
+
Greg supports [Carbon Ads](https://www.carbonads.net/) natively. When configured,
|
|
8
|
+
an ad unit is displayed at the bottom of the right-side Outline panel.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Pass the `carbonAds` prop to `<MarkdownDocs>`:
|
|
14
|
+
|
|
15
|
+
```svelte
|
|
16
|
+
<MarkdownDocs
|
|
17
|
+
srcDir="/"
|
|
18
|
+
version="1.0.0"
|
|
19
|
+
carbonAds={{ code: 'CWYD42JW', placement: 'myprojectdev' }}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| Option | Type | Description |
|
|
24
|
+
| ----------- | -------- | ------------------------------ |
|
|
25
|
+
| `code` | `string` | Your Carbon Ads `serve` code |
|
|
26
|
+
| `placement` | `string` | Your Carbon Ads placement name |
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Behaviour
|
|
30
|
+
|
|
31
|
+
- The Carbon Ads script is injected once on `onMount`.
|
|
32
|
+
- On every SPA navigation, `_carbonads.refresh()` is called automatically so the
|
|
33
|
+
ad unit updates for the new page context.
|
|
34
|
+
- If `carbonAds` is not provided (the default), no script is injected and the
|
|
35
|
+
Outline panel right edge is not shown.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Styling
|
|
39
|
+
|
|
40
|
+
Carbon Ads renders inside a `.CarbonAds` container. Override the appearance with:
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
:root {
|
|
44
|
+
--greg-carbon-ads-bg-color: #f0f0f4; /* falls back to --greg-menu-background */
|
|
45
|
+
}
|
|
46
|
+
```
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Code Group
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Code Group
|
|
6
|
+
|
|
7
|
+
`Code Group` lets you present multiple related code snippets as tabs.
|
|
8
|
+
Use it when you want to show equivalent commands for different tools
|
|
9
|
+
or languages in one compact block.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
`Code Group` supports two authoring styles:
|
|
14
|
+
|
|
15
|
+
- Markdown directive syntax (`::: code-group ... :::`)
|
|
16
|
+
- Component-tag syntax (`<CodeGroup ... />`)
|
|
17
|
+
|
|
18
|
+
### Markdown directive syntax
|
|
19
|
+
|
|
20
|
+
Write a `::: code-group` container and include one code block per tab.
|
|
21
|
+
|
|
22
|
+
````md
|
|
23
|
+
::: code-group labels=[npm, pnpm, yarn]
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm i @dominikcz/greg
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @dominikcz/greg
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn add @dominikcz/greg
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
:::
|
|
38
|
+
````
|
|
39
|
+
|
|
40
|
+
**Output:**
|
|
41
|
+
|
|
42
|
+
::: code-group labels=[npm, pnpm, yarn]
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm i @dominikcz/greg
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm add @dominikcz/greg
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
yarn add @dominikcz/greg
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
:::
|
|
57
|
+
|
|
58
|
+
### Component-tag syntax
|
|
59
|
+
|
|
60
|
+
When writing `.svelte` pages/components directly, you can render tabs with
|
|
61
|
+
the `CodeGroup` component.
|
|
62
|
+
|
|
63
|
+
```svelte
|
|
64
|
+
<script>
|
|
65
|
+
import CodeGroup from '$components/CodeGroup.svelte';
|
|
66
|
+
|
|
67
|
+
const tabs = ['npm', 'pnpm'];
|
|
68
|
+
const blocks = [
|
|
69
|
+
`<pre class="shiki"><code>npm i @dominikcz/greg</code></pre>`,
|
|
70
|
+
`<pre class="shiki"><code>pnpm add @dominikcz/greg</code></pre>`,
|
|
71
|
+
];
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<CodeGroup {tabs} {blocks} initialActive={0} />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Output:**
|
|
78
|
+
|
|
79
|
+
Equivalent tabbed UI as in the Markdown directive example above.
|
|
80
|
+
|
|
81
|
+
## Labels inferred from code blocks
|
|
82
|
+
|
|
83
|
+
When `labels=[...]` is omitted, labels are inferred from each block's language
|
|
84
|
+
or code title.
|
|
85
|
+
|
|
86
|
+
````md
|
|
87
|
+
::: code-group
|
|
88
|
+
|
|
89
|
+
```js [config.js]
|
|
90
|
+
export default {
|
|
91
|
+
docsDir: 'docs',
|
|
92
|
+
};
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```ts [config.ts]
|
|
96
|
+
export default {
|
|
97
|
+
docsDir: 'docs',
|
|
98
|
+
} as const;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
:::
|
|
102
|
+
````
|
|
103
|
+
|
|
104
|
+
**Output:**
|
|
105
|
+
|
|
106
|
+
::: code-group
|
|
107
|
+
|
|
108
|
+
```js [config.js]
|
|
109
|
+
export default {
|
|
110
|
+
docsDir: 'docs',
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```ts [config.ts]
|
|
115
|
+
export default {
|
|
116
|
+
docsDir: 'docs',
|
|
117
|
+
} as const;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
:::
|
|
121
|
+
|
|
122
|
+
## Keyboard interaction
|
|
123
|
+
|
|
124
|
+
- `Left` / `Right`: move between tabs
|
|
125
|
+
- `Home` / `End`: jump to first/last tab
|
|
126
|
+
- `Enter` or `Space`: activate focused tab
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Home Page
|
|
3
|
+
renderer: mdsvex
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Greg does not use frontmatter-based layouts. Instead, the `<Hero>` and
|
|
7
|
+
`<Features>` components are used directly inside Markdown pages to compose a
|
|
8
|
+
landing / home page.
|
|
9
|
+
|
|
10
|
+
For these components there is no dedicated directive/container shorthand
|
|
11
|
+
(like `::: ...`). Use component tags directly (`<Hero ... />`,
|
|
12
|
+
`<Features ... />`).
|
|
13
|
+
|
|
14
|
+
## Authoring styles
|
|
15
|
+
|
|
16
|
+
`Hero` and `Features` are available in both authoring contexts:
|
|
17
|
+
|
|
18
|
+
- Markdown docs pages (`.md`) via component tags
|
|
19
|
+
- Direct `.svelte` usage via imported components
|
|
20
|
+
|
|
21
|
+
In Markdown pages, Greg auto-registers these components, so no import is needed.
|
|
22
|
+
In plain `.svelte` files, you still need explicit imports.
|
|
23
|
+
|
|
24
|
+
## Hero
|
|
25
|
+
|
|
26
|
+
The `<Hero>` component renders a large introductory section with a name, tagline,
|
|
27
|
+
optional image and call-to-action buttons.
|
|
28
|
+
|
|
29
|
+
::: code-group labels=[markdown, output]
|
|
30
|
+
|
|
31
|
+
<<< @/snippets/reference/home-hero-example.md
|
|
32
|
+
|
|
33
|
+
<Hero
|
|
34
|
+
name="My Project"
|
|
35
|
+
text="The fastest way to document things."
|
|
36
|
+
tagline="Write once, ship everywhere."
|
|
37
|
+
image={{
|
|
38
|
+
light: { src: '/greg-logo-light.svg', alt: 'My Project logo' },
|
|
39
|
+
dark: { src: '/greg-logo-dark.svg', alt: 'My Project logo' },
|
|
40
|
+
}}
|
|
41
|
+
actions={[
|
|
42
|
+
{ theme: 'brand', text: 'Get Started', link: '/guide/getting-started' },
|
|
43
|
+
{ theme: 'alt', text: 'GitHub', link: 'https://github.com/dominikcz/greg' },
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
:::
|
|
48
|
+
|
|
49
|
+
### Direct component usage for Hero (`.svelte`)
|
|
50
|
+
|
|
51
|
+
In `.svelte` files, import the component explicitly:
|
|
52
|
+
|
|
53
|
+
::: code-group labels=[svelte, output]
|
|
54
|
+
|
|
55
|
+
```svelte
|
|
56
|
+
<script>
|
|
57
|
+
import Hero from '$components/Hero.svelte';
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<Hero
|
|
61
|
+
name="My Project"
|
|
62
|
+
text="The fastest way to document things."
|
|
63
|
+
tagline="Write once, ship everywhere."
|
|
64
|
+
image={{
|
|
65
|
+
light: { src: '/greg-logo-light.svg', alt: 'My Project logo' },
|
|
66
|
+
dark: { src: '/greg-logo-dark.svg', alt: 'My Project logo' },
|
|
67
|
+
}}
|
|
68
|
+
actions={[
|
|
69
|
+
{ theme: 'brand', text: 'Get Started', link: '/guide/getting-started' },
|
|
70
|
+
{ theme: 'alt', text: 'GitHub', link: 'https://github.com/dominikcz/greg' },
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
<Hero
|
|
76
|
+
name="My Project"
|
|
77
|
+
text="The fastest way to document things."
|
|
78
|
+
tagline="Write once, ship everywhere."
|
|
79
|
+
image={{
|
|
80
|
+
light: { src: '/greg-logo-light.svg', alt: 'My Project logo' },
|
|
81
|
+
dark: { src: '/greg-logo-dark.svg', alt: 'My Project logo' },
|
|
82
|
+
}}
|
|
83
|
+
actions={[
|
|
84
|
+
{ theme: 'brand', text: 'Get Started', link: '/guide/getting-started' },
|
|
85
|
+
{ theme: 'alt', text: 'GitHub', link: 'https://github.com/dominikcz/greg' },
|
|
86
|
+
]}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
:::
|
|
90
|
+
|
|
91
|
+
### Props
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
interface HeroAction {
|
|
95
|
+
theme?: 'brand' | 'alt'; // default: 'brand'
|
|
96
|
+
text: string;
|
|
97
|
+
link: string;
|
|
98
|
+
target?: string;
|
|
99
|
+
rel?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type ThemeImage =
|
|
103
|
+
| string // same image for both themes
|
|
104
|
+
| { src: string; alt?: string; width?: number | string; height?: number | string }
|
|
105
|
+
| {
|
|
106
|
+
light: string | { src: string; alt?: string; width?: number | string; height?: number | string };
|
|
107
|
+
dark: string | { src: string; alt?: string; width?: number | string; height?: number | string };
|
|
108
|
+
alt?: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
interface Props {
|
|
112
|
+
name?: string; // product name - displayed with accent colour
|
|
113
|
+
text?: string; // main tagline (h1)
|
|
114
|
+
tagline?: string; // sub-tagline
|
|
115
|
+
image?: ThemeImage; // optional hero image (right side)
|
|
116
|
+
actions?: HeroAction[];
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
If you use a manual theme toggle, prefer the `light`/`dark` image pair form.
|
|
121
|
+
A single image with only `@media (prefers-color-scheme)` follows system theme,
|
|
122
|
+
not necessarily the in-app toggle state.
|
|
123
|
+
|
|
124
|
+
### Snippet slots
|
|
125
|
+
|
|
126
|
+
For advanced customisation, `Hero` exposes several Svelte snippet slots:
|
|
127
|
+
|
|
128
|
+
| Snippet | Position |
|
|
129
|
+
| ------------------ | ------------------------------------ |
|
|
130
|
+
| `heroBefore` | Before the name/text block |
|
|
131
|
+
| `heroInfo` | Replaces the entire name + tagline |
|
|
132
|
+
| `heroInfoAfter` | After tagline, before action buttons |
|
|
133
|
+
| `heroImage` | Replaces the default image |
|
|
134
|
+
| `heroActionsAfter` | After the action buttons |
|
|
135
|
+
|
|
136
|
+
## Features
|
|
137
|
+
|
|
138
|
+
The `<Features>` component renders a responsive grid of feature cards below the
|
|
139
|
+
Hero section.
|
|
140
|
+
|
|
141
|
+
::: code-group labels=[markdown, output]
|
|
142
|
+
|
|
143
|
+
<<< @/snippets/reference/home-features-example.md
|
|
144
|
+
|
|
145
|
+
<Features
|
|
146
|
+
features={[
|
|
147
|
+
{ icon: 'docs', title: 'Markdown-first', details: 'Rich extensions, zero config.' },
|
|
148
|
+
{ icon: 'vite', title: 'Vite-powered', details: 'Instant HMR and fast builds.' },
|
|
149
|
+
{ icon: 'svelte', title: 'Svelte 5', details: 'Runes-based, no overhead.' },
|
|
150
|
+
]}
|
|
151
|
+
/>
|
|
152
|
+
|
|
153
|
+
:::
|
|
154
|
+
|
|
155
|
+
### Direct component usage (`.svelte`)
|
|
156
|
+
|
|
157
|
+
In `.svelte` files, import the component explicitly:
|
|
158
|
+
|
|
159
|
+
::: code-group labels=[svelte, output]
|
|
160
|
+
|
|
161
|
+
```svelte
|
|
162
|
+
<script>
|
|
163
|
+
import Features from '$components/Features.svelte';
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<Features
|
|
167
|
+
features={[
|
|
168
|
+
{ icon: 'docs', title: 'Markdown-first', details: 'Rich extensions, zero config.' },
|
|
169
|
+
{ icon: 'vite', title: 'Vite-powered', details: 'Instant HMR and fast builds.' },
|
|
170
|
+
{ icon: 'svelte', title: 'Svelte 5', details: 'Runes-based, no overhead.' },
|
|
171
|
+
]}
|
|
172
|
+
/>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
<Features
|
|
176
|
+
features={[
|
|
177
|
+
{ icon: 'docs', title: 'Markdown-first', details: 'Rich extensions, zero config.' },
|
|
178
|
+
{ icon: 'vite', title: 'Vite-powered', details: 'Instant HMR and fast builds.' },
|
|
179
|
+
{ icon: 'svelte', title: 'Svelte 5', details: 'Runes-based, no overhead.' },
|
|
180
|
+
]}
|
|
181
|
+
/>
|
|
182
|
+
|
|
183
|
+
:::
|
|
184
|
+
|
|
185
|
+
### Icon types
|
|
186
|
+
|
|
187
|
+
Icons can be emoji strings, image URLs, or dark/light image pairs:
|
|
188
|
+
|
|
189
|
+
```md
|
|
190
|
+
<Features features={[
|
|
191
|
+
{ icon: 'tool', title: 'Tooling', details: 'Fast setup.' },
|
|
192
|
+
{ icon: { src: '/icons/rocket.svg' }, title: 'Launch', details: 'Ready to go.' },
|
|
193
|
+
{ icon: { dark: '/icons/d.svg', light: '/icons/l.svg' }, title: 'Theme-aware', details: 'Matches color mode.' },
|
|
194
|
+
]} />
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Feature props
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
interface Feature {
|
|
201
|
+
icon?: string | { src: string; alt?: string; width?: number; height?: number }
|
|
202
|
+
| { dark: string; light: string; alt?: string };
|
|
203
|
+
title: string;
|
|
204
|
+
details?: string;
|
|
205
|
+
link?: string; // makes the whole card clickable
|
|
206
|
+
linkText?: string; // "Learn more" style label
|
|
207
|
+
rel?: string;
|
|
208
|
+
target?: string;
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Grid layout
|
|
213
|
+
|
|
214
|
+
The grid automatically adapts based on the number of features:
|
|
215
|
+
|
|
216
|
+
| Count | Layout |
|
|
217
|
+
| ------------- | ---------------------- |
|
|
218
|
+
| 2 | 2-column |
|
|
219
|
+
| 3 | 3-column |
|
|
220
|
+
| 4 or 5 | 2 + 3 mixed |
|
|
221
|
+
| Multiple of 3 | 3-column |
|
|
222
|
+
| Other | 4-column with wrapping |
|
|
223
|
+
|
|
224
|
+
## Full home page example
|
|
225
|
+
|
|
226
|
+
::: code-group labels=[markdown, output]
|
|
227
|
+
|
|
228
|
+
<<< @/snippets/reference/home-full-example.md
|
|
229
|
+
|
|
230
|
+
<!--@include: @/snippets/reference/home-full-example.md-->
|
|
231
|
+
|
|
232
|
+
:::
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Reference
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Reference
|
|
6
|
+
|
|
7
|
+
API and component reference for Greg.
|
|
8
|
+
|
|
9
|
+
- [`<MarkdownDocs>` Component](./markdowndocs) — props and Vite configuration
|
|
10
|
+
- [Badge](./badge) — inline status badge component
|
|
11
|
+
- [Carbon Ads](./carbon-ads) — advertising integration
|
|
12
|
+
- [Code Group](./code-group) — tabbed code blocks
|
|
13
|
+
- [Home Page — Hero & Features](./home-page) — landing page components
|
|
14
|
+
- [Outline](./outline) — on-this-page panel
|
|
15
|
+
- [Search](./search) — full-text search configuration
|
|
16
|
+
- [Steps](./steps) — numbered procedural steps component
|
|
17
|
+
- [Team Page](./team-page) — team member display components
|
|
18
|
+
- [Theme & Styling](./theme) — CSS variables and dark/light mode
|