euv_docs/model/struct.rs
1use super::*;
2
3/// Optional site-level metadata declared under `site:` in root Markdown frontmatter.
4#[derive(Clone, Debug, Default, Deserialize, Getter, PartialEq, Serialize)]
5pub struct DocSiteFrontmatter {
6 /// Optional site display title.
7 pub(crate) title: Option<String>,
8 /// Optional site summary tagline.
9 pub(crate) description: Option<String>,
10 /// Optional brand logo or monogram text.
11 pub(crate) logo: Option<String>,
12 /// Optional footer attribution line.
13 pub(crate) footer: Option<String>,
14}
15
16/// Parsed YAML frontmatter metadata attached to a Markdown documentation file.
17#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
18pub struct DocFrontmatter {
19 /// Optional document title.
20 pub(crate) title: Option<String>,
21 /// Optional numeric sidebar sort order.
22 pub(crate) order: Option<i32>,
23 /// Optional tagline for home/landing pages.
24 pub(crate) tagline: Option<String>,
25 /// Optional section group name.
26 pub(crate) section: Option<String>,
27 /// Optional site-level configuration block.
28 pub(crate) site: Option<DocSiteFrontmatter>,
29}
30
31/// Compact search index record serialized into `search-index.json` and embedded client search.
32#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
33pub struct SearchIndexEntry {
34 /// Canonical route path for navigation.
35 pub(crate) route: String,
36 /// Document title.
37 pub(crate) title: String,
38 /// Section category label.
39 pub(crate) section: String,
40 /// Short page description or lead excerpt.
41 pub(crate) summary: String,
42 /// Concatenated heading titles for keyword matching.
43 pub(crate) headings: Vec<String>,
44 /// Plain-text searchable body excerpt.
45 pub(crate) excerpt: String,
46}
47
48/// Table-of-contents heading entry derived from a parsed document.
49#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
50pub struct DocTocItem {
51 /// Heading depth from 1 to 6.
52 #[get(type(copy))]
53 pub(crate) level: u8,
54 /// Anchor slug for jump navigation.
55 pub(crate) slug: String,
56 /// Display title text.
57 pub(crate) title: String,
58}
59
60/// Fully parsed documentation page ready for native rendering or static generation.
61#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
62pub struct DocPage {
63 /// Canonical route path (for example `/guide/getting-started`).
64 pub(crate) route: String,
65 /// Resolved page title.
66 pub(crate) title: String,
67 /// Sidebar sort order.
68 #[get(type(copy))]
69 pub(crate) order: i32,
70 /// Section category label.
71 pub(crate) section: String,
72 /// Short summary or tagline.
73 pub(crate) summary: String,
74 /// Structured Markdown content blocks.
75 pub(crate) blocks: Vec<DocBlock>,
76 /// Table-of-contents headings.
77 pub(crate) toc: Vec<DocTocItem>,
78 /// Preserved Markdown body text (after frontmatter) for full-fidelity HTML generation.
79 #[serde(default, skip_serializing_if = "String::is_empty")]
80 #[get(pub(crate))]
81 #[new(skip)]
82 pub(crate) markdown_body: String,
83}
84
85/// Collection of parsed documentation pages forming a complete site.
86#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
87pub struct DocSite {
88 /// Site brand title.
89 pub(crate) title: String,
90 /// Site description tagline.
91 pub(crate) tagline: String,
92 /// Ordered documentation pages.
93 pub(crate) pages: Vec<DocPage>,
94}