euv-docs 0.48.2

Cross-platform documentation viewer and static site generator powered by euv and euv-ui.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
use super::*;

/// Single externally supplied footer item (for example a filing notice with optional local badge icon).
#[derive(Clone, Debug, Default, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct DocFooterItem {
    /// Selectable link text rendered in the footer row.
    #[serde(default)]
    pub(crate) text: String,
    /// Destination URL opened by this footer item.
    #[serde(default)]
    pub(crate) link: String,
    /// Optional site-relative local icon path rendered before `text`.
    #[serde(default)]
    pub(crate) icon: String,
    /// Optional accessible alt label for `icon`.
    #[serde(default)]
    pub(crate) alt: String,
}

/// Single top-bar navigation link declared under a locale's `navbar:` list.
#[derive(Clone, Debug, Default, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct DocNavbarItem {
    /// Visible navigation link label.
    #[serde(default)]
    pub(crate) text: String,
    /// Internal route or external destination URL.
    #[serde(default)]
    pub(crate) link: String,
}

/// Per-locale site configuration declared under `locales:` in root `README.md` frontmatter.
#[derive(Clone, Debug, Default, Deserialize, Eq, Getter, PartialEq, Serialize)]
pub struct DocLocaleConfig {
    /// Public URL route prefix (e.g. `"/"`, `"/en/"`, `"/ja/"`, `"/ko/"`).
    #[serde(default)]
    pub(crate) prefix: String,
    /// Source content directory beneath `<src_dir>` (e.g. `"zh"`, `"en"`, `"ja"`, `"ko"`).
    #[serde(default)]
    pub(crate) dir: String,
    /// BCP 47 HTML language tag (e.g. `"zh-CN"`, `"en-US"`, `"ja-JP"`, `"ko-KR"`).
    #[serde(default)]
    pub(crate) lang: String,
    /// Human-readable language switcher label (e.g. `"简体中文"`, `"English"`).
    #[serde(default)]
    pub(crate) label: String,
    /// Optional locale-specific site title override.
    #[serde(default)]
    pub(crate) title: Option<String>,
    /// Optional locale-specific site description override.
    #[serde(default)]
    pub(crate) description: Option<String>,
    /// Optional localized footer attribution line.
    #[serde(default)]
    pub(crate) footer: Option<String>,
    /// Optional localized table-of-contents heading label.
    #[serde(default)]
    pub(crate) toc_label: Option<String>,
    /// Optional localized previous-page pager label.
    #[serde(default)]
    pub(crate) prev_label: Option<String>,
    /// Optional localized next-page pager label.
    #[serde(default)]
    pub(crate) next_label: Option<String>,
    /// Optional localized top navbar links.
    #[serde(default)]
    pub(crate) navbar: Vec<DocNavbarItem>,
}

/// Call-to-action button declared under `actions:` on a `home: true` landing page.
#[derive(Clone, Debug, Default, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct DocHomeAction {
    /// Button display text.
    #[serde(default)]
    pub(crate) text: String,
    /// Internal route or external URL opened when clicked.
    #[serde(default)]
    pub(crate) link: String,
    /// Optional symbolic icon name.
    #[serde(default)]
    pub(crate) icon: String,
    /// Visual emphasis kind (`"primary"` or `"secondary"`).
    #[serde(rename = "type", default)]
    pub(crate) kind: String,
}

/// Key metric tile declared under `stats:` on a `home: true` landing page.
#[derive(Clone, Debug, Default, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct DocHomeStat {
    /// Leading glyph or icon label.
    #[serde(default)]
    pub(crate) icon: String,
    /// Prominent metric value (e.g. `"100%"`, `"WASM"`).
    #[serde(default)]
    pub(crate) value: String,
    /// Concise metric description caption.
    #[serde(default)]
    pub(crate) label: String,
}

/// Feature or product card declared under `features:` on a `home: true` landing page.
#[derive(Clone, Debug, Default, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct DocHomeFeature {
    /// Card heading title.
    #[serde(default)]
    pub(crate) title: String,
    /// Card summary details copy.
    #[serde(default)]
    pub(crate) details: String,
    /// Optional external or internal destination URL.
    #[serde(default)]
    pub(crate) link: String,
}

/// Optional site-level metadata declared under `site:` in root Markdown frontmatter.
#[derive(Clone, Debug, Default, Deserialize, Getter, PartialEq, Serialize)]
pub struct DocSiteFrontmatter {
    /// Optional site display title.
    pub(crate) title: Option<String>,
    /// Optional site summary tagline.
    pub(crate) description: Option<String>,
    /// Optional brand logo URL or monogram text.
    pub(crate) logo: Option<String>,
    /// Optional footer attribution line.
    pub(crate) footer: Option<String>,
    /// Optional URL opened when clicking the primary footer attribution text.
    #[serde(default)]
    pub(crate) footer_link: Option<String>,
    /// Externally supplied footer links and optional local badge icons.
    #[serde(default)]
    pub(crate) footer_items: Vec<DocFooterItem>,
}

/// Combined multi-locale site configuration parsed from root `README.md` frontmatter.
#[derive(Clone, Debug, Default, Deserialize, Getter, PartialEq, Serialize)]
pub struct DocSiteConfig {
    /// Shared site-level metadata and footer items.
    #[serde(default)]
    pub(crate) site: DocSiteFrontmatter,
    /// Declared site locales (empty for single-locale documentation trees).
    #[serde(default)]
    pub(crate) locales: Vec<DocLocaleConfig>,
}

/// Directory presentation metadata parsed from a VuePress-style `dir:` frontmatter block.
#[derive(Clone, Debug, Default, Deserialize, Getter, PartialEq, Serialize)]
pub struct DocDirFrontmatter {
    /// Explicit sort order for this directory among its sibling entries.
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) order: Option<i32>,
    /// Optional display label override for this directory in the sidebar tree.
    #[serde(default)]
    pub(crate) text: Option<String>,
    /// Optional flag indicating whether clicking the directory links to its README index.
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) link: Option<bool>,
    /// Optional flag indicating whether the directory branch is collapsible.
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) collapsible: Option<bool>,
}

/// Parsed YAML frontmatter metadata attached to a Markdown documentation file.
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct DocFrontmatter {
    /// Optional document title.
    pub(crate) title: Option<String>,
    /// Optional numeric sidebar sort order.
    pub(crate) order: Option<i32>,
    /// Optional tagline for home/landing pages.
    pub(crate) tagline: Option<String>,
    /// Optional page summary description.
    #[serde(default)]
    pub(crate) description: Option<String>,
    /// Optional section group name.
    pub(crate) section: Option<String>,
    /// Optional last-updated date or release string.
    #[serde(default)]
    pub(crate) updated: Option<String>,
    /// Optional publication date string (e.g. `2025-11-23`).
    #[serde(default)]
    pub(crate) date: Option<String>,
    /// Optional category tags attached to the page.
    #[serde(default)]
    pub(crate) category: Vec<String>,
    /// Optional directory index toggle (`Some(false)` marks a directory overview/folder index without duplicating README as a child).
    #[serde(default)]
    pub(crate) index: Option<bool>,
    /// Optional initial sidebar expansion toggle (`Some(false)` starts collapsed unless on the active ancestor path).
    #[serde(default)]
    pub(crate) expanded: Option<bool>,
    /// Optional nested `dir:` frontmatter block controlling folder order, text, link, and collapsibility.
    #[serde(default)]
    pub(crate) dir: Option<DocDirFrontmatter>,
    /// Optional page or directory password protecting content until unlocked.
    #[serde(default)]
    pub(crate) password: Option<String>,
    /// Optional raw HTML `<head>` metadata array preserved transparently during YAML parsing.
    #[serde(default)]
    pub(crate) head: Value,
    /// When `true`, renders this page with the hero/actions/stats/features/catalog landing layout.
    #[serde(default)]
    pub(crate) home: bool,
    /// Optional hero display heading for landing pages.
    #[serde(rename = "heroText", default)]
    pub(crate) hero_text: Option<String>,
    /// Optional landing-page call-to-action buttons.
    #[serde(default)]
    pub(crate) actions: Vec<DocHomeAction>,
    /// Optional landing-page metric tiles.
    #[serde(default)]
    pub(crate) stats: Vec<DocHomeStat>,
    /// Optional landing-page feature and product cards.
    #[serde(default)]
    pub(crate) features: Vec<DocHomeFeature>,
    /// Optional explicit VuePress-style sidebar child ordering (`[dir_or_stem, ...]`).
    #[serde(default)]
    pub(crate) sidebar_order: Vec<String>,
    /// Optional flag controlling sidebar inclusion (`Some(false)` hides page from sidebar tree).
    #[serde(default)]
    pub(crate) sidebar: Option<bool>,
    /// Optional site-level configuration block.
    pub(crate) site: Option<DocSiteFrontmatter>,
    /// Optional multi-locale configuration block.
    #[serde(default)]
    pub(crate) locales: Vec<DocLocaleConfig>,
}

/// Recursive filesystem-mirrored catalog tree node powering the left documentation sidebar.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct DocCatalogNode {
    /// Stable tree key (`"euv/core"` for directories, canonical route for files).
    pub(crate) key: String,
    /// Visible sidebar display label.
    pub(crate) title: String,
    /// Optional direct document route rendered when activating this node.
    pub(crate) route: Option<String>,
    /// First ordered readable descendant document route (used for auto-navigation on empty-README or README-less folders).
    pub(crate) first_child_route: Option<String>,
    /// Whether this entry represents a filesystem directory.
    #[get(type(copy))]
    pub(crate) is_dir: bool,
    /// Whether the directory README declared `index: false`.
    #[get(type(copy))]
    pub(crate) index_disabled: bool,
    /// Whether this node owns non-empty document body content.
    #[get(type(copy))]
    pub(crate) has_own_content: bool,
    /// Explicit frontmatter expansion override (`Some(false)` starts collapsed, `Some(true)` starts expanded).
    #[get(type(copy))]
    pub(crate) expanded_pref: Option<bool>,
    /// Whether the directory can be collapsed interactively.
    #[get(type(copy))]
    pub(crate) collapsible: bool,
    /// Effective numeric sort order within its parent directory.
    #[get(type(copy))]
    pub(crate) order: i32,
    /// Whether this node or an ancestor directory requires password unlock.
    #[get(type(copy))]
    pub(crate) locked: bool,
    /// Ordered child entries strictly mirroring the filesystem hierarchy.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub(crate) children: Vec<DocCatalogNode>,
}

/// Nested hierarchical table-of-contents tree node derived from flat page headings.
#[derive(Clone, Data, Debug, Deserialize, PartialEq, Serialize)]
pub struct DocTocTreeNode {
    /// Heading item at this tree node.
    pub(crate) item: DocTocItem,
    /// Ordered deeper-level child headings nested beneath this heading.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub(crate) children: Vec<DocTocTreeNode>,
}

/// Single published project artifact returned by `/api/page-artifacts` and rendered in Rust.
#[derive(Clone, Debug, Default, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct DocsCatalogArtifact {
    /// Published project or qualified `org/repo` artifact name.
    pub(crate) name: String,
    /// Total number of files in the published artifact.
    #[get(type(copy))]
    pub(crate) file_count: u64,
    /// Total artifact payload size in raw bytes.
    #[get(type(copy))]
    pub(crate) total_bytes: u64,
    /// Hex-encoded lowercase SHA-256 digest of the artifact.
    pub(crate) sha256: String,
    /// Publication timestamp as Unix epoch seconds (UTC).
    #[get(type(copy))]
    pub(crate) updated_at: i64,
}

/// Compact search index record serialized into `search-index.json` and embedded client search.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct SearchIndexEntry {
    /// Canonical route path for navigation.
    pub(crate) route: String,
    /// Document title.
    pub(crate) title: String,
    /// Section category label.
    pub(crate) section: String,
    /// Short page description or lead excerpt.
    pub(crate) summary: String,
    /// Concatenated heading titles for keyword matching.
    pub(crate) headings: Vec<String>,
    /// Plain-text searchable body excerpt.
    pub(crate) excerpt: String,
}

/// Table-of-contents heading entry derived from a parsed document.
#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
pub struct DocTocItem {
    /// Heading depth from 1 to 6.
    #[get(type(copy))]
    pub(crate) level: u8,
    /// Anchor slug for jump navigation.
    pub(crate) slug: String,
    /// Display title text.
    pub(crate) title: String,
}

/// Fully parsed documentation page ready for native rendering or static generation.
#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
pub struct DocPage {
    /// Canonical route path (for example `/guide/getting-started`).
    pub(crate) route: String,
    /// Resolved page title.
    pub(crate) title: String,
    /// Sidebar sort order.
    #[get(type(copy))]
    pub(crate) order: i32,
    /// Section category label.
    pub(crate) section: String,
    /// Short summary or tagline.
    pub(crate) summary: String,
    /// Structured Markdown content blocks.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub(crate) blocks: Vec<DocBlock>,
    /// Table-of-contents headings.
    pub(crate) toc: Vec<DocTocItem>,
    /// Preserved Markdown body text (after frontmatter) for full-fidelity HTML and native rendering.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[get(pub(crate))]
    #[new(skip)]
    pub(crate) markdown_body: String,
    /// Optional last-updated date or version stamp parsed from frontmatter.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[new(skip)]
    pub(crate) updated: Option<String>,
    /// Whether this page declares `home: true` in frontmatter.
    #[serde(default)]
    #[get(type(copy))]
    #[new(skip)]
    pub(crate) is_home: bool,
    /// Optional hero display heading for home pages.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[new(skip)]
    pub(crate) hero_text: Option<String>,
    /// Landing-page call-to-action buttons.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[new(skip)]
    pub(crate) actions: Vec<DocHomeAction>,
    /// Landing-page metric tiles.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[new(skip)]
    pub(crate) stats: Vec<DocHomeStat>,
    /// Landing-page feature and product cards.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[new(skip)]
    pub(crate) features: Vec<DocHomeFeature>,
    /// When `true`, hides this page from the sidebar navigation tree.
    #[serde(default)]
    #[get(type(copy))]
    #[new(skip)]
    pub(crate) hide_sidebar: bool,
    /// Relative forward-slash filesystem path inside the locale root (e.g. `"euv/core/README.md"`).
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) source_rel_path: String,
    /// Whether this document originated from a directory `README.md` or `index.md` file.
    #[serde(default)]
    #[get(type(copy))]
    #[new(skip)]
    pub(crate) is_dir_index: bool,
    /// Whether directory README indexing is disabled via `index: false` frontmatter.
    #[serde(default)]
    #[get(type(copy))]
    #[new(skip)]
    pub(crate) index_disabled: bool,
    /// Optional initial directory expansion override parsed from `expanded: true|false`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[get(type(copy))]
    #[new(skip)]
    pub(crate) dir_expanded: Option<bool>,
    /// Optional directory sort order parsed from `dir.order`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[get(type(copy))]
    #[new(skip)]
    pub(crate) dir_order: Option<i32>,
    /// Optional directory display text override parsed from `dir.text`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[new(skip)]
    pub(crate) dir_text: Option<String>,
    /// Optional directory collapsible flag parsed from `dir.collapsible`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[get(type(copy))]
    #[new(skip)]
    pub(crate) dir_collapsible: Option<bool>,
    /// Optional effective password protecting this page (declared directly or inherited from a parent directory README).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[new(skip)]
    pub(crate) password: Option<String>,
    /// Optional publication date string parsed from `date:` frontmatter.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[new(skip)]
    pub(crate) date: Option<String>,
    /// Optional category tags parsed from `category:` frontmatter.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[new(skip)]
    pub(crate) categories: Vec<String>,
}

/// Collection of parsed documentation pages forming a complete site or locale bundle.
#[derive(Clone, Data, Debug, Deserialize, New, PartialEq, Serialize)]
pub struct DocSite {
    /// Site brand title.
    pub(crate) title: String,
    /// Site description tagline.
    pub(crate) tagline: String,
    /// Ordered documentation pages.
    pub(crate) pages: Vec<DocPage>,
    /// Active BCP 47 HTML language tag (e.g. `"en-US"`, `"zh-CN"`).
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) lang: String,
    /// Active locale route prefix (e.g. `"/"`, `"/en/"`).
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) locale_prefix: String,
    /// Optional brand logo URL.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) logo: String,
    /// Localized footer attribution line.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) footer: String,
    /// Optional URL opened by clicking the primary footer attribution text.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) footer_link: String,
    /// Externally supplied footer links and optional local icons.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[new(skip)]
    pub(crate) footer_items: Vec<DocFooterItem>,
    /// Localized table-of-contents heading label.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) toc_label: String,
    /// Localized previous-page pager label.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) prev_label: String,
    /// Localized next-page pager label.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) next_label: String,
    /// Localized top navbar links.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[new(skip)]
    pub(crate) navbar: Vec<DocNavbarItem>,
    /// Available site locales for the language switcher.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[new(skip)]
    pub(crate) locales: Vec<DocLocaleConfig>,
    /// Embedded release version marker carried in serialized WASM site bundles.
    #[serde(default, skip_serializing_if = "String::is_empty")]
    #[new(skip)]
    pub(crate) release_marker: String,
}