Color mode

Reference

Reference は、Riebeckite の設定値・CLI・公開 API・Theme・内部構造を調べるための章です。

「どう使えばいいか」という手順を知りたい場合は Guides を参照してください。

Diagram source
text
flowchart TD
    Q{"何を知りたい?"}
 
    Q -->|"使い方・手順"| Guides["Guides"]
    Q -->|"設定・Command・API・Theme"| Reference["Reference"]
    Q -->|"内部構造・仕組み"| Framework["Framework"]

Reference は最初から順番に読む必要はありません。設定項目や API を確認したくなったときに、必要なページを参照してください。

ページ

知りたいこと ページ
riebeckite.config.ts の設定 Configuration
riebeckite.config.ts の全フィールド Configuration リファレンス
CLI Command とその役割 CLI
Plugin の Public API Plugin API
Theme の Public API Theme API
Riebeckite の内部構造 Framework
Theme の作り方 Themes

Configuration

Configuration では、

  • site
  • content
  • markdown
  • theme
  • plugins
  • appRoot
  • configRoot
  • contentRoot

など、Riebeckite の設定とその解決方法を確認できます。

CLI

CLI では、

text
init
dev
check
doctor
build
profile
inspect

の各 Command と、その役割を確認できます。

Plugin API

Plugin API では、

  • definePlugin
  • Lifecycle Hook
  • Content Hook
  • Renderer
  • Page Type
  • Assets
  • Client Entry
  • Endpoint
  • Diagnostics

など、Plugin が利用できる Public Contract を確認できます。

Plugin の仕組みそのものを理解したい場合は Plugin System を参照してください。

Theme API

Theme API では、

  • defineTheme
  • Design Token
  • Color Mode
  • Typography
  • Article Layout
  • CSS Contract
  • Theme Package

など、Theme が利用できる Public Contract を確認できます。

Theme の設計思想や仕組みを理解したい場合は Theme System を参照してください。

公開 Package

Riebeckite の外部 Plugin / Theme / Site は、公開 Package と公開 Export だけに依存してください。

主な Package は次のとおりです。

Package 用途
@riebeckite/core Config、Content、Plugin、Theme、Pipeline などの共通 API
@riebeckite/cli riebeckite CLI
@riebeckite/honox HonoX / Vite Integration と Scaffold。server subpath に route / SSG helper(resolveRiebeckiteRoute、resolveRiebeckiteContentRequest、resolveRiebeckiteHomeRequest、contentRouteSsgParams、riebeniteSsgParams)、ui subpath に article / site の UI primitive(Article、ArticleBody、PageBody、ArticleContent、ContentSlot、hasSlot と各種 Props 型)を公開
@riebeckite/test テスト helper(assertGolden、assertGoldenJson)。e2e subpath に packed tarball の外部 site engine
@riebeckite/plugin-* 各 Plugin
@riebeckite/theme-* 各 Theme

依存関係は概ね次のようになります。

Diagram source
text
flowchart BT
    Site["Site"]
    ExternalPlugin["External Plugin"]
    ExternalTheme["External Theme"]
 
    Honox["@riebeckite/honox"]
    Core["@riebeckite/core"]
 
    Site --> Honox
    Site --> Core
    ExternalPlugin --> Core
    ExternalTheme --> Core
    Honox --> Core

外部 Package から Riebeckite monorepo の内部実装へ直接依存しないことが重要です。

Public API と Internal API

外部 Package では Package の Public Export を利用します。

たとえば、

ts
import {
  definePlugin,
  escapeHtml,
} from "@riebeckite/core";

のように Import します。

一方、次のような Import は使用しないでください。

ts
import {
  something,
} from "@riebeckite/core/src/...";

また、

text
../../../../packages/core/...

のような Riebeckite monorepo 内部の Path にも依存しません。

Diagram source
text
flowchart LR
    Consumer["External Package"]
 
    Consumer -->|"✓"| Public["@riebeckite/core<br/>Public Export"]
    Consumer -.->|"✗"| Internal["@riebeckite/core/src/**"]
    Consumer -.->|"✗"| Monorepo["Monorepo Internal Path"]

Public API は外部利用を前提とした Contract です。

src/** や monorepo 内部 Path は実装詳細であり、Package の更新によって変更される可能性があります。

@riebeckite/core

@riebeckite/core は、Riebeckite の Framework 非依存な Public API を提供します。

主な Export は次のとおりです。

Config

text
defineConfig
resolveConfig
resolveConfigModule
isPublished
isExcluded

Config の宣言、解決、Publication Policy などに使用します。

詳しくは Configuration を参照してください。

Content

text
ContentManager
ContentCollection
ContentGraph
ContentQuery
buildContentCollections
fingerprintContentEntries
resolveDefaultContentLocation

Content の読み込み、解決、Collection、Graph、Query、Public Location などに使用します。

仕組みについては Content System を参照してください。

Plugins

text
definePlugin
resolvePlugins
defineEndpoint
createStyleAsset
createClientEntry
appendContentBodySlot
createPluginMemo
stableStringify

Plugin の定義や解決、Endpoint などに使用します。

Plugin を作成する場合は Plugin API と プラグイン作成の詳細 を参照してください。

Themes

text
defineTheme
RiebeckiteTheme
ThemeDesignTokens
ThemeColorMode
ThemeTypographyPreset
ThemeArticleLayoutPreset

Theme の定義と Presentation Contract に使用します。

Theme を作成する場合は Theme API と テーマ作成の詳細 を参照してください。

Pipeline

text
Pipeline
MarkdownPipeline
HtmlPipeline

Markdown / HTML の処理 Pipeline を拡張するときに使用します。

通常の Site 利用で直接扱う必要はありません。

Utilities

text
escapeHtml
escapeHtmlAttribute
normalizeTag
calculateReadingTime
stripHtml

Plugin や Integration から利用できる共通 Utility です。

Observability

text
Logger
Tracer
TraceSpan
TraceSink

Log や Trace を Framework と統合するための型です。

詳しくは Observability を参照してください。

どのドキュメントを見るべきか

迷った場合は、次の基準で選べます。

Diagram source
text
flowchart TD
    Start["知りたいこと"]
 
    Start --> Use{"具体的な手順?"}
    Use -->|Yes| Guides["Guides"]
    Use -->|No| API{"設定値やAPIを調べたい?"}
 
    API -->|Yes| Reference["Reference"]
    API -->|No| Internal{"内部の仕組みを知りたい?"}
 
    Internal -->|Yes| Framework["Framework"]
    Internal -->|No| GettingStarted["Getting Started"]

簡単に分けると、

text
サイトを作り始めたい
  → Getting Started
 
具体的な作業手順を知りたい
  → Guides
 
設定・CLI・APIを調べたい
  → Reference
 
Riebeckiteの内部構造を理解したい
  → Framework

です。

Reference は API の使い方を探すための索引として使い、設計思想や内部実装の説明は Framework、実際の作業手順は Guides と役割を分けています。

History

1 changesCollapseExpand
1 + ---
2 + title: Reference
3 + sidebar:
4 + label: Reference
5 + order: 40
6 + ---
7 + # Reference
8 +
9 + Reference は、Riebeckite の**設定値・CLI・公開 API・Theme・内部構造を調べるための章**です。
10 +
11 + 「どう使えばいいか」という手順を知りたい場合は [Guides](../guides/README.md) を参照してください。
12 +
13 + ```mermaid id="h2qw1n"
14 + flowchart TD
15 + Q{"何を知りたい?"}
16 +
17 + Q -->|"使い方・手順"| Guides["Guides"]
18 + Q -->|"設定・Command・API・Theme"| Reference["Reference"]
19 + Q -->|"内部構造・仕組み"| Framework["Framework"]
20 + ```
21 +
22 + Reference は最初から順番に読む必要はありません。設定項目や API を確認したくなったときに、必要なページを参照してください。
23 +
24 + ## ページ
25 +
26 + | 知りたいこと | ページ |
27 + | --- | --- |
28 + | `riebeckite.config.ts` の設定 | [Configuration](./configuration.md) |
29 + | `riebeckite.config.ts` の全フィールド | [Configuration リファレンス](./configuration-reference.md) |
30 + | CLI Command とその役割 | [CLI](./cli.md) |
31 + | Plugin の Public API | [Plugin API](./plugin-api.md) |
32 + | Theme の Public API | [Theme API](./theme-api.md) |
33 + | Riebeckite の内部構造 | [Framework](../framework/README.md) |
34 + | Theme の作り方 | [Themes](../themes/README.md) |
35 +
36 + ### Configuration
37 +
38 + [Configuration](./configuration.md) では、
39 +
40 + - `site`
41 + - `content`
42 + - `markdown`
43 + - `theme`
44 + - `plugins`
45 + - `appRoot`
46 + - `configRoot`
47 + - `contentRoot`
48 +
49 + など、Riebeckite の設定とその解決方法を確認できます。
50 +
51 + ### CLI
52 +
53 + [CLI](./cli.md) では、
54 +
55 + ```text
56 + init
57 + dev
58 + check
59 + doctor
60 + build
61 + profile
62 + inspect
63 + ```
64 +
65 + の各 Command と、その役割を確認できます。
66 +
67 + ### Plugin API
68 +
69 + [Plugin API](./plugin-api.md) では、
70 +
71 + - `definePlugin`
72 + - Lifecycle Hook
73 + - Content Hook
74 + - Renderer
75 + - Page Type
76 + - Assets
77 + - Client Entry
78 + - Endpoint
79 + - Diagnostics
80 +
81 + など、Plugin が利用できる Public Contract を確認できます。
82 +
83 + Plugin の仕組みそのものを理解したい場合は [Plugin System](../framework/plugin-system.md) を参照してください。
84 +
85 + ### Theme API
86 +
87 + [Theme API](./theme-api.md) では、
88 +
89 + - `defineTheme`
90 + - Design Token
91 + - Color Mode
92 + - Typography
93 + - Article Layout
94 + - CSS Contract
95 + - Theme Package
96 +
97 + など、Theme が利用できる Public Contract を確認できます。
98 +
99 + Theme の設計思想や仕組みを理解したい場合は [Theme System](../framework/theme-system.md) を参照してください。
100 +
101 + ## 公開 Package
102 +
103 + Riebeckite の外部 Plugin / Theme / Site は、**公開 Package と公開 Export だけ**に依存してください。
104 +
105 + 主な Package は次のとおりです。
106 +
107 + | Package | 用途 |
108 + | --- | --- |
109 + | `@riebeckite/core` | Config、Content、Plugin、Theme、Pipeline などの共通 API |
110 + | `@riebeckite/cli` | `riebeckite` CLI |
111 + | `@riebeckite/honox` | HonoX / Vite Integration と Scaffold。`server` subpath に route / SSG helper(`resolveRiebeckiteRoute`、`resolveRiebeckiteContentRequest`、`resolveRiebeckiteHomeRequest`、`contentRouteSsgParams`、`riebeniteSsgParams`)、`ui` subpath に article / site の UI primitive(`Article`、`ArticleBody`、`PageBody`、`ArticleContent`、`ContentSlot`、`hasSlot` と各種 Props 型)を公開 |
112 + | `@riebeckite/test` | テスト helper(`assertGolden`、`assertGoldenJson`)。`e2e` subpath に packed tarball の外部 site engine |
113 + | `@riebeckite/plugin-*` | 各 Plugin |
114 + | `@riebeckite/theme-*` | 各 Theme |
115 +
116 + 依存関係は概ね次のようになります。
117 +
118 + ```mermaid id="65lzss"
119 + flowchart BT
120 + Site["Site"]
121 + ExternalPlugin["External Plugin"]
122 + ExternalTheme["External Theme"]
123 +
124 + Honox["@riebeckite/honox"]
125 + Core["@riebeckite/core"]
126 +
127 + Site --> Honox
128 + Site --> Core
129 + ExternalPlugin --> Core
130 + ExternalTheme --> Core
131 + Honox --> Core
132 + ```
133 +
134 + 外部 Package から Riebeckite monorepo の内部実装へ直接依存しないことが重要です。
135 +
136 + ## Public API と Internal API
137 +
138 + 外部 Package では Package の Public Export を利用します。
139 +
140 + たとえば、
141 +
142 + ```ts
143 + import {
144 + definePlugin,
145 + escapeHtml,
146 + } from "@riebeckite/core";
147 + ```
148 +
149 + のように Import します。
150 +
151 + 一方、次のような Import は使用しないでください。
152 +
153 + ```ts
154 + import {
155 + something,
156 + } from "@riebeckite/core/src/...";
157 + ```
158 +
159 + また、
160 +
161 + ```text
162 + ../../../../packages/core/...
163 + ```
164 +
165 + のような Riebeckite monorepo 内部の Path にも依存しません。
166 +
167 + ```mermaid id="8n7pvm"
168 + flowchart LR
169 + Consumer["External Package"]
170 +
171 + Consumer -->|"✓"| Public["@riebeckite/core<br/>Public Export"]
172 + Consumer -.->|"✗"| Internal["@riebeckite/core/src/**"]
173 + Consumer -.->|"✗"| Monorepo["Monorepo Internal Path"]
174 + ```
175 +
176 + Public API は外部利用を前提とした Contract です。
177 +
178 + `src/**` や monorepo 内部 Path は実装詳細であり、Package の更新によって変更される可能性があります。
179 +
180 + ## `@riebeckite/core`
181 +
182 + `@riebeckite/core` は、Riebeckite の Framework 非依存な Public API を提供します。
183 +
184 + 主な Export は次のとおりです。
185 +
186 + ### Config
187 +
188 + ```text
189 + defineConfig
190 + resolveConfig
191 + resolveConfigModule
192 + isPublished
193 + isExcluded
194 + ```
195 +
196 + Config の宣言、解決、Publication Policy などに使用します。
197 +
198 + 詳しくは [Configuration](./configuration.md) を参照してください。
199 +
200 + ### Content
201 +
202 + ```text
203 + ContentManager
204 + ContentCollection
205 + ContentGraph
206 + ContentQuery
207 + buildContentCollections
208 + fingerprintContentEntries
209 + resolveDefaultContentLocation
210 + ```
211 +
212 + Content の読み込み、解決、Collection、Graph、Query、Public Location などに使用します。
213 +
214 + 仕組みについては [Content System](../framework/content-system.md) を参照してください。
215 +
216 + ### Plugins
217 +
218 + ```text
219 + definePlugin
220 + resolvePlugins
221 + defineEndpoint
222 + createStyleAsset
223 + createClientEntry
224 + appendContentBodySlot
225 + createPluginMemo
226 + stableStringify
227 + ```
228 +
229 + Plugin の定義や解決、Endpoint などに使用します。
230 +
231 + Plugin を作成する場合は [Plugin API](./plugin-api.md) と [プラグイン作成の詳細](../framework/plugin-system.md) を参照してください。
232 +
233 + ### Themes
234 +
235 + ```text
236 + defineTheme
237 + RiebeckiteTheme
238 + ThemeDesignTokens
239 + ThemeColorMode
240 + ThemeTypographyPreset
241 + ThemeArticleLayoutPreset
242 + ```
243 +
244 + Theme の定義と Presentation Contract に使用します。
245 +
246 + Theme を作成する場合は [Theme API](./theme-api.md) と [テーマ作成の詳細](../framework/theme-system.md) を参照してください。
247 +
248 + ### Pipeline
249 +
250 + ```text
251 + Pipeline
252 + MarkdownPipeline
253 + HtmlPipeline
254 + ```
255 +
256 + Markdown / HTML の処理 Pipeline を拡張するときに使用します。
257 +
258 + 通常の Site 利用で直接扱う必要はありません。
259 +
260 + ### Utilities
261 +
262 + ```text
263 + escapeHtml
264 + escapeHtmlAttribute
265 + normalizeTag
266 + calculateReadingTime
267 + stripHtml
268 + ```
269 +
270 + Plugin や Integration から利用できる共通 Utility です。
271 +
272 + ### Observability
273 +
274 + ```text
275 + Logger
276 + Tracer
277 + TraceSpan
278 + TraceSink
279 + ```
280 +
281 + Log や Trace を Framework と統合するための型です。
282 +
283 + 詳しくは [Observability](../framework/observability.md) を参照してください。
284 +
285 + ## どのドキュメントを見るべきか
286 +
287 + 迷った場合は、次の基準で選べます。
288 +
289 + ```mermaid id="q2v3n8"
290 + flowchart TD
291 + Start["知りたいこと"]
292 +
293 + Start --> Use{"具体的な手順?"}
294 + Use -->|Yes| Guides["Guides"]
295 + Use -->|No| API{"設定値やAPIを調べたい?"}
296 +
297 + API -->|Yes| Reference["Reference"]
298 + API -->|No| Internal{"内部の仕組みを知りたい?"}
299 +
300 + Internal -->|Yes| Framework["Framework"]
301 + Internal -->|No| GettingStarted["Getting Started"]
302 + ```
303 +
304 + 簡単に分けると、
305 +
306 + ```text
307 + サイトを作り始めたい
308 + → Getting Started
309 +
310 + 具体的な作業手順を知りたい
311 + → Guides
312 +
313 + 設定・CLI・APIを調べたい
314 + → Reference
315 +
316 + Riebeckiteの内部構造を理解したい
317 + → Framework
318 + ```
319 +
320 + です。
321 +
322 + Reference は **API の使い方を探すための索引**として使い、設計思想や内部実装の説明は Framework、実際の作業手順は Guides と役割を分けています。
323 +