stropress 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +307 -0
- package/dist/theme-default/package.json +20 -0
- package/dist/theme-default/postcss.config.mjs +5 -0
- package/dist/theme-default/src/components/BaseHead.astro +53 -0
- package/dist/theme-default/src/components/DocToc.astro +111 -0
- package/dist/theme-default/src/components/GithubIcon.astro +35 -0
- package/dist/theme-default/src/components/HomePage.astro +198 -0
- package/dist/theme-default/src/components/Icon.astro +78 -0
- package/dist/theme-default/src/components/LocaleSelect.astro +187 -0
- package/dist/theme-default/src/components/NavBar.astro +231 -0
- package/dist/theme-default/src/components/SearchInput.astro +84 -0
- package/dist/theme-default/src/components/SearchModal.astro +209 -0
- package/dist/theme-default/src/components/Sidebar.astro +101 -0
- package/dist/theme-default/src/content/docs/guide/configuration.mdx +195 -0
- package/dist/theme-default/src/content/docs/guide/getting-started.md +98 -0
- package/dist/theme-default/src/content/docs/guide/search.mdx +41 -0
- package/dist/theme-default/src/content/docs/index.css +0 -0
- package/dist/theme-default/src/content/docs/index.md +6 -0
- package/dist/theme-default/src/content/docs/zh/guide/configuration.mdx +149 -0
- package/dist/theme-default/src/content/docs/zh/guide/getting-started.md +31 -0
- package/dist/theme-default/src/content/docs/zh/guide/search.mdx +23 -0
- package/dist/theme-default/src/content/docs/zh/index.astro +75 -0
- package/dist/theme-default/src/content/docs/zh/index.md +6 -0
- package/dist/theme-default/src/content.config.ts +14 -0
- package/dist/theme-default/src/env.d.ts +15 -0
- package/dist/theme-default/src/layouts/DocsLayout.astro +278 -0
- package/dist/theme-default/src/lib/config.ts +195 -0
- package/dist/theme-default/src/lib/custom-home.ts +40 -0
- package/dist/theme-default/src/lib/custom-style.ts +11 -0
- package/dist/theme-default/src/lib/og.ts +275 -0
- package/dist/theme-default/src/pages/[...slug]/index.astro +83 -0
- package/dist/theme-default/src/pages/index.astro +47 -0
- package/dist/theme-default/src/pages/og/[...slug].png.ts +70 -0
- package/dist/theme-default/src/scripts/code-copy.ts +54 -0
- package/dist/theme-default/src/scripts/doc-toc.ts +109 -0
- package/dist/theme-default/src/scripts/search.ts +329 -0
- package/dist/theme-default/src/styles/global.css +70 -0
- package/dist/theme-default/src/styles/markdown.css +141 -0
- package/dist/theme-default/tsconfig.json +10 -0
- package/package.json +32 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<div class="site-search-trigger" data-search-open>
|
|
2
|
+
<button
|
|
3
|
+
id="site-search-trigger-button"
|
|
4
|
+
class="site-search-trigger-button"
|
|
5
|
+
type="button"
|
|
6
|
+
aria-label="Open search"
|
|
7
|
+
aria-haspopup="dialog"
|
|
8
|
+
data-search-trigger
|
|
9
|
+
>
|
|
10
|
+
<span class="site-search-trigger-text">Search...</span>
|
|
11
|
+
</button>
|
|
12
|
+
<span class="site-search-shortcut" aria-hidden="true">⌘K</span>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<style is:global>
|
|
16
|
+
.site-search-trigger {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
width: min(10rem, 20vw);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.site-search-trigger-button {
|
|
24
|
+
width: 100%;
|
|
25
|
+
border: 1px solid rgba(var(--border-color) / 1);
|
|
26
|
+
border-radius: var(--border-radius);
|
|
27
|
+
background: rgba(var(--background-color) / 0.92);
|
|
28
|
+
color: rgba(var(--foreground-color) / 1);
|
|
29
|
+
text-align: left;
|
|
30
|
+
font-size: 0.875rem;
|
|
31
|
+
line-height: 1;
|
|
32
|
+
padding: 0.7rem 4.25rem 0.7rem 1rem;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
transition:
|
|
35
|
+
border-color 160ms ease,
|
|
36
|
+
box-shadow 160ms ease;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.site-search-trigger-text {
|
|
40
|
+
color: rgba(var(--muted-color) / 1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.site-search-trigger-button:hover,
|
|
44
|
+
.site-search-trigger-button:focus-visible {
|
|
45
|
+
border-color: rgba(var(--foreground-color) / 0.35);
|
|
46
|
+
box-shadow: 0 0 0 4px rgba(var(--foreground-color) / 0.06);
|
|
47
|
+
outline: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.site-search-shortcut {
|
|
51
|
+
position: absolute;
|
|
52
|
+
right: 0.55rem;
|
|
53
|
+
top: 50%;
|
|
54
|
+
transform: translateY(-50%);
|
|
55
|
+
border-radius: 999px;
|
|
56
|
+
border: 1px solid rgba(var(--border-color) / 1);
|
|
57
|
+
padding: 0.2rem 0.5rem;
|
|
58
|
+
font-size: 0.72rem;
|
|
59
|
+
color: rgba(var(--muted-color) / 1);
|
|
60
|
+
background: rgba(var(--background-color) / 0.95);
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.site-search-sr-only {
|
|
65
|
+
position: absolute;
|
|
66
|
+
width: 1px;
|
|
67
|
+
height: 1px;
|
|
68
|
+
margin: -1px;
|
|
69
|
+
border: 0;
|
|
70
|
+
padding: 0;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
clip-path: inset(100%);
|
|
73
|
+
clip: rect(0 0 0 0);
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media (max-width: 900px) {
|
|
78
|
+
.site-search-trigger {
|
|
79
|
+
width: 100%;
|
|
80
|
+
max-width: 100%;
|
|
81
|
+
order: 3;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { SearchDocument } from "../scripts/search";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
documents: SearchDocument[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const { documents } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class="site-search-modal"
|
|
13
|
+
data-search-modal
|
|
14
|
+
data-search-documents={JSON.stringify(documents)}
|
|
15
|
+
data-state="closed"
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
>
|
|
18
|
+
<button
|
|
19
|
+
class="site-search-modal-backdrop"
|
|
20
|
+
type="button"
|
|
21
|
+
aria-label="Close search"
|
|
22
|
+
data-search-close></button>
|
|
23
|
+
<section
|
|
24
|
+
class="site-search-panel"
|
|
25
|
+
role="dialog"
|
|
26
|
+
aria-modal="true"
|
|
27
|
+
aria-labelledby="site-search-title"
|
|
28
|
+
>
|
|
29
|
+
<div class="site-search-panel-header">
|
|
30
|
+
<h2 id="site-search-title">Search Documentation</h2>
|
|
31
|
+
<button
|
|
32
|
+
class="site-search-close"
|
|
33
|
+
type="button"
|
|
34
|
+
aria-label="Close search"
|
|
35
|
+
data-search-close
|
|
36
|
+
>
|
|
37
|
+
Esc
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<input
|
|
42
|
+
id="site-search-modal-input"
|
|
43
|
+
class="site-search-input"
|
|
44
|
+
type="search"
|
|
45
|
+
placeholder="Type to search..."
|
|
46
|
+
autocomplete="off"
|
|
47
|
+
spellcheck="false"
|
|
48
|
+
data-search-input
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<p class="site-search-hint" data-search-hint>
|
|
52
|
+
Press ↑/↓ to navigate, Enter to open.
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<ul class="site-search-results" data-search-results></ul>
|
|
56
|
+
|
|
57
|
+
<p class="site-search-empty" data-search-empty hidden>No results found.</p>
|
|
58
|
+
</section>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
import { setupSearch } from "../scripts/search";
|
|
63
|
+
|
|
64
|
+
const modal = document.querySelector<HTMLElement>("[data-search-modal]");
|
|
65
|
+
const rawDocuments = modal?.dataset.searchDocuments || "[]";
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const documents = JSON.parse(rawDocuments);
|
|
69
|
+
if (Array.isArray(documents)) {
|
|
70
|
+
setupSearch(documents);
|
|
71
|
+
}
|
|
72
|
+
} catch {
|
|
73
|
+
setupSearch([]);
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style is:global>
|
|
78
|
+
.site-search-modal {
|
|
79
|
+
position: fixed;
|
|
80
|
+
inset: 0;
|
|
81
|
+
z-index: 80;
|
|
82
|
+
display: none;
|
|
83
|
+
width: 100vw;
|
|
84
|
+
height: 100vh;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.site-search-modal[data-state="open"] {
|
|
88
|
+
display: grid;
|
|
89
|
+
place-items: start center;
|
|
90
|
+
padding: clamp(1rem, 5vh, 5rem) 1rem 1rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.site-search-modal-backdrop {
|
|
94
|
+
position: absolute;
|
|
95
|
+
inset: 0;
|
|
96
|
+
border: 0;
|
|
97
|
+
background: rgba(10 10 10 / 0.44);
|
|
98
|
+
backdrop-filter: blur(3px);
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.site-search-panel {
|
|
103
|
+
position: relative;
|
|
104
|
+
width: min(44rem, 100%);
|
|
105
|
+
border-radius: 1rem;
|
|
106
|
+
border: 1px solid rgba(var(--border-color) / 1);
|
|
107
|
+
background: rgba(var(--background-color) / 1);
|
|
108
|
+
box-shadow:
|
|
109
|
+
0 22px 60px rgba(0 0 0 / 0.24),
|
|
110
|
+
0 1px 0 rgba(255 255 255 / 0.08) inset;
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.site-search-panel-header {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: space-between;
|
|
118
|
+
gap: 1rem;
|
|
119
|
+
padding: 1rem 1rem 0.5rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.site-search-panel-header h2 {
|
|
123
|
+
margin: 0;
|
|
124
|
+
font-size: 1rem;
|
|
125
|
+
font-weight: 650;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.site-search-close {
|
|
129
|
+
border: 1px solid rgba(var(--border-color) / 1);
|
|
130
|
+
background: transparent;
|
|
131
|
+
color: rgba(var(--muted-color) / 1);
|
|
132
|
+
border-radius: 0.5rem;
|
|
133
|
+
font-size: 0.75rem;
|
|
134
|
+
padding: 0.25rem 0.5rem;
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.site-search-input {
|
|
139
|
+
width: calc(100% - 2rem);
|
|
140
|
+
margin: 0.5rem 1rem 0;
|
|
141
|
+
border-radius: 0.75rem;
|
|
142
|
+
border: 1px solid rgba(var(--border-color) / 1);
|
|
143
|
+
padding: 0.75rem 0.875rem;
|
|
144
|
+
font-size: 0.95rem;
|
|
145
|
+
background: rgba(var(--background-color) / 1);
|
|
146
|
+
color: rgba(var(--foreground-color) / 1);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.site-search-input:focus-visible {
|
|
150
|
+
border-color: rgba(var(--foreground-color) / 0.38);
|
|
151
|
+
box-shadow: 0 0 0 4px rgba(var(--foreground-color) / 0.08);
|
|
152
|
+
outline: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.site-search-hint {
|
|
156
|
+
margin: 0;
|
|
157
|
+
padding: 0.55rem 1rem 0.85rem;
|
|
158
|
+
font-size: 0.78rem;
|
|
159
|
+
color: rgba(var(--muted-color) / 1);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.site-search-results {
|
|
163
|
+
list-style: none;
|
|
164
|
+
margin: 0;
|
|
165
|
+
padding: 0.25rem;
|
|
166
|
+
max-height: min(26rem, 60vh);
|
|
167
|
+
overflow-y: auto;
|
|
168
|
+
border-top: 1px solid rgba(var(--border-color) / 1);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.site-search-result-item {
|
|
172
|
+
margin: 0;
|
|
173
|
+
border-radius: 0.75rem;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.site-search-result-link {
|
|
177
|
+
display: grid;
|
|
178
|
+
gap: 0.2rem;
|
|
179
|
+
padding: 0.7rem 0.8rem;
|
|
180
|
+
border-radius: 0.75rem;
|
|
181
|
+
transition: background 120ms ease;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.site-search-result-link:hover,
|
|
185
|
+
.site-search-result-link:focus-visible,
|
|
186
|
+
.site-search-result-item[data-state="active"] .site-search-result-link {
|
|
187
|
+
background: rgba(var(--accent-color) / 1);
|
|
188
|
+
outline: none;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.site-search-result-title {
|
|
192
|
+
font-size: 0.92rem;
|
|
193
|
+
font-weight: 630;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.site-search-result-desc {
|
|
197
|
+
font-size: 0.82rem;
|
|
198
|
+
line-height: 1.45;
|
|
199
|
+
color: rgba(var(--muted-color) / 1);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.site-search-empty {
|
|
203
|
+
margin: 0;
|
|
204
|
+
padding: 1rem;
|
|
205
|
+
font-size: 0.88rem;
|
|
206
|
+
color: rgba(var(--muted-color) / 1);
|
|
207
|
+
border-top: 1px solid rgba(var(--border-color) / 1);
|
|
208
|
+
}
|
|
209
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Icon from "./Icon.astro";
|
|
3
|
+
import { getResolvedSiteConfig } from "../lib/config";
|
|
4
|
+
|
|
5
|
+
const groups = getResolvedSiteConfig(Astro.url.pathname).sidebar;
|
|
6
|
+
const pathname = Astro.url.pathname;
|
|
7
|
+
|
|
8
|
+
const normalizePath = (input: string) => {
|
|
9
|
+
if (!input || input === "/") {
|
|
10
|
+
return "/";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return input.endsWith("/") ? input.slice(0, -1) : input;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const currentPath = normalizePath(pathname);
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<div class="sidebar">
|
|
20
|
+
{
|
|
21
|
+
groups.map((group) => (
|
|
22
|
+
<section class="sidebar-link-group">
|
|
23
|
+
<label class="sidebar-link-group-label">{group.label}</label>
|
|
24
|
+
<ul class="sidebar-link-list">
|
|
25
|
+
{group.items.map((item) => (
|
|
26
|
+
<li class="sidebar-link-item">
|
|
27
|
+
<a
|
|
28
|
+
href={item.link}
|
|
29
|
+
class="sidebar-link"
|
|
30
|
+
data-state={
|
|
31
|
+
currentPath === normalizePath(item.link)
|
|
32
|
+
? "active"
|
|
33
|
+
: "inactive"
|
|
34
|
+
}
|
|
35
|
+
>
|
|
36
|
+
<span>{item.label}</span>
|
|
37
|
+
</a>
|
|
38
|
+
</li>
|
|
39
|
+
))}
|
|
40
|
+
</ul>
|
|
41
|
+
</section>
|
|
42
|
+
))
|
|
43
|
+
}
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<style is:global>
|
|
47
|
+
.sidebar {
|
|
48
|
+
position: sticky;
|
|
49
|
+
top: 5.5rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.sidebar-link-group {
|
|
53
|
+
font-size: 0.875rem;
|
|
54
|
+
|
|
55
|
+
.sidebar-link-group-icon {
|
|
56
|
+
width: 1.1rem;
|
|
57
|
+
height: 1.1rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sidebar-link-group-label {
|
|
61
|
+
padding: 0.5rem;
|
|
62
|
+
font-weight: 700;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.sidebar-icon {
|
|
67
|
+
width: 0.9rem;
|
|
68
|
+
height: 0.9rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.sidebar-link-list {
|
|
72
|
+
list-style: none;
|
|
73
|
+
padding: 0.5rem;
|
|
74
|
+
margin: 0;
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.sidebar-link {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: 0.45rem;
|
|
83
|
+
border-radius: 0.25rem;
|
|
84
|
+
padding: 0.45rem 0.75rem;
|
|
85
|
+
|
|
86
|
+
&[data-state="active"],
|
|
87
|
+
&:hover {
|
|
88
|
+
background: rgba(var(--accent-color) / 1);
|
|
89
|
+
color: rgba(var(--foreground-color) / 1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@media (max-width: 900px) {
|
|
94
|
+
.sidebar {
|
|
95
|
+
position: static;
|
|
96
|
+
padding: 0 0 1.5rem;
|
|
97
|
+
border-bottom: 1px solid
|
|
98
|
+
color-mix(in srgb, rgba(var(--foreground-color) / 1) 12%, transparent);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: Configure navbar and sidebar
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configuration
|
|
7
|
+
|
|
8
|
+
Use `docs/config.json` to define the navigation structure.
|
|
9
|
+
|
|
10
|
+
- `navbar`: top navigation items
|
|
11
|
+
- `nav`: primary header links shown next to social links
|
|
12
|
+
- `sidebar`: side navigation groups
|
|
13
|
+
- `search`: local search options
|
|
14
|
+
- `markdown`: markdown rendering options
|
|
15
|
+
|
|
16
|
+
## Site URL
|
|
17
|
+
|
|
18
|
+
Set `site.url` in `docs/config.json` to control canonical URLs and OG image URLs in generated HTML.
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"site": {
|
|
23
|
+
"url": "https://docs.example.com",
|
|
24
|
+
"title": "Stropress Docs",
|
|
25
|
+
"description": "Documentation site powered by stropress"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If `site.url` is omitted, Stropress falls back to `http://localhost:4321` for local development.
|
|
31
|
+
|
|
32
|
+
## Search
|
|
33
|
+
|
|
34
|
+
Default search uses local MiniSearch indexing from your markdown content.
|
|
35
|
+
|
|
36
|
+
You can keep the default behavior or set it explicitly in `docs/config.json`:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"search": {
|
|
41
|
+
"provider": "local"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Code Block Theme
|
|
47
|
+
|
|
48
|
+
Configure code block highlighting theme via `markdown.codeTheme` in `docs/config.json`.
|
|
49
|
+
|
|
50
|
+
Use a single theme:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"markdown": {
|
|
55
|
+
"codeTheme": "github-dark"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or define separate light/dark themes:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"markdown": {
|
|
65
|
+
"codeTheme": {
|
|
66
|
+
"light": "github-light",
|
|
67
|
+
"dark": "github-dark"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Common theme names (supported by Astro via Shiki, depending on your Astro/Shiki version):
|
|
74
|
+
|
|
75
|
+
- `github-light`
|
|
76
|
+
- `github-dark`
|
|
77
|
+
- `one-dark-pro`
|
|
78
|
+
- `dracula`
|
|
79
|
+
- `nord`
|
|
80
|
+
- `material-theme-darker`
|
|
81
|
+
- `catppuccin-latte`
|
|
82
|
+
- `catppuccin-frappe`
|
|
83
|
+
- `catppuccin-macchiato`
|
|
84
|
+
- `catppuccin-mocha`
|
|
85
|
+
|
|
86
|
+
Example with One Dark + Catppuccin:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"markdown": {
|
|
91
|
+
"codeTheme": {
|
|
92
|
+
"light": "catppuccin-latte",
|
|
93
|
+
"dark": "one-dark-pro"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If a theme name is invalid for your current version, build/dev will report a theme loading error.
|
|
100
|
+
|
|
101
|
+
## Bilingual Locales
|
|
102
|
+
|
|
103
|
+
Stropress supports locale blocks inspired by VitePress.
|
|
104
|
+
|
|
105
|
+
Define `locales` in `docs/config.json`, using path prefixes as keys:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"locales": {
|
|
110
|
+
"/": {
|
|
111
|
+
"label": "English",
|
|
112
|
+
"lang": "en-US"
|
|
113
|
+
},
|
|
114
|
+
"/zh/": {
|
|
115
|
+
"label": "简体中文",
|
|
116
|
+
"lang": "zh-CN",
|
|
117
|
+
"site": {
|
|
118
|
+
"title": "Stropress 文档",
|
|
119
|
+
"description": "使用 Stropress 构建文档站点"
|
|
120
|
+
},
|
|
121
|
+
"nav": [
|
|
122
|
+
{
|
|
123
|
+
"label": "指南",
|
|
124
|
+
"link": "/zh/guide/getting-started"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"sidebar": [
|
|
128
|
+
{
|
|
129
|
+
"label": "指南",
|
|
130
|
+
"items": [
|
|
131
|
+
{
|
|
132
|
+
"label": "快速开始",
|
|
133
|
+
"link": "/zh/guide/getting-started"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Recommendations:
|
|
144
|
+
|
|
145
|
+
- Put localized markdown under folders such as `docs/zh/...`.
|
|
146
|
+
- Use locale-prefixed links in locale `nav`, `navbar`, and `sidebar`.
|
|
147
|
+
- Add `docs/zh/index.md` to enable a clean `/zh/` landing route.
|
|
148
|
+
|
|
149
|
+
## Custom Homepage
|
|
150
|
+
|
|
151
|
+
If JSON-based `home` configuration is too limiting, you can add Astro homepage files next to `config.json`:
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
docs/
|
|
155
|
+
config.json
|
|
156
|
+
index.astro
|
|
157
|
+
zh/
|
|
158
|
+
index.astro
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- `docs/index.astro` overrides the root homepage `/`.
|
|
162
|
+
- `docs/zh/index.astro` overrides the localized homepage `/zh/`.
|
|
163
|
+
- If a matching `index.astro` exists, Stropress will prefer it over `home` or `locales[locale].home`.
|
|
164
|
+
|
|
165
|
+
These files render inside the default docs layout. You can optionally export page metadata from Astro frontmatter:
|
|
166
|
+
|
|
167
|
+
```astro
|
|
168
|
+
---
|
|
169
|
+
export const title = "Custom Home";
|
|
170
|
+
export const description = "Landing page built with Astro";
|
|
171
|
+
export const sidebar = false;
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
<section>
|
|
175
|
+
<h1>Custom homepage</h1>
|
|
176
|
+
</section>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Global Style Overrides
|
|
180
|
+
|
|
181
|
+
You can add a root-level stylesheet at `docs/index.css` to override the default theme styles globally.
|
|
182
|
+
|
|
183
|
+
This file is loaded after the built-in theme CSS, so it can be used to override `:root` variables and any selectors used by the theme.
|
|
184
|
+
|
|
185
|
+
```css
|
|
186
|
+
:root {
|
|
187
|
+
--background-color: 250 247 240;
|
|
188
|
+
--foreground-color: 28 28 28;
|
|
189
|
+
--primary-color: 176 78 44;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.topbar {
|
|
193
|
+
backdrop-filter: blur(20px);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Getting Started
|
|
3
|
+
description: Start your documentation site
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Getting Started
|
|
7
|
+
|
|
8
|
+
Your markdown files under `docs/` will be rendered into HTML pages.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Codeblock
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
console.log("hello word")
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
> This is a quote
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- This is a list
|
|
24
|
+
- This is a list
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## TODO LIST
|
|
28
|
+
|
|
29
|
+
- [ ] todo1
|
|
30
|
+
- [x] todo2
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
This is a [Link](https://xuco.me)
|
|
34
|
+
|
|
35
|
+
| 配置项 | 必填 | 说明 | 建议 |
|
|
36
|
+
| :----------- | :--: | :----------------------------- | :------------------------------------- |
|
|
37
|
+
| **名称** | 是 | API Key 的标识名称 | 设置为项目名或用途,如 `Chat-Bot-Prod` |
|
|
38
|
+
| **模型** | 是 | 选择该 Key 支持调用的模型范围 | **注意**:未勾选的模型将无法发起请求 |
|
|
39
|
+
| **请求上限** | 否 | 设置单次或周期内的请求次数限制 | 用于防止程序异常导致的消耗过快 |
|
|
40
|
+
| **额度** | 否 | 设置该 Key 可使用的最高额度 | 建议根据项目预算分配独立额度 |
|
|
41
|
+
| **过期时间** | 否 | 设置 Key 的有效期限 | 临时测试建议设置有效期,长期项目可留空 |
|
|
42
|
+
|
|
43
|
+
> [!IMPORTANT]
|
|
44
|
+
> **关于密钥可见性**
|
|
45
|
+
> 为了保障您的账户安全,所有 API Key 在数据库中均经过**加密处理**。
|
|
46
|
+
>
|
|
47
|
+
> - **仅限创建时查看**:API Key 仅在点击“完成创建”后的弹出窗口中完整显示**一次**。
|
|
48
|
+
> - **后续不可找回**:一旦关闭弹窗,您将无法再次在控制台查看到完整的 Key 内容。
|
|
49
|
+
> - **若丢失怎么办**:如果您遗失了该 Key,将无法找回,必须通过「删除旧 Key 并重新创建」的方式来获取新的密钥。
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
> [!TIP]
|
|
53
|
+
> **遇到 404 错误?**
|
|
54
|
+
> 若页面提示「错误 404」,通常是由于登录状态刷新延迟。请点击页面中的 **「返回控制台」** 按钮,或从侧边导航栏重新进入即可。
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
console.log("hello word")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
console.log("hello word")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
console.log("hello word")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
console.log("hello word")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## H2
|
|
75
|
+
|
|
76
|
+
### H3
|
|
77
|
+
|
|
78
|
+
#### H4
|
|
79
|
+
|
|
80
|
+
##### H5
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
console.log("hello word")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
console.log("hello word")
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
console.log("hello word")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
console.log("hello word")
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+

|