pub struct DocsConfig { /* private fields */ }Expand description
Builder for constructing a DocsRegistry.
§Example
let registry = DocsConfig::new(nav_json, content_map)
.with_openapi("api-reference", spec_yaml)
.with_default_path("getting-started/introduction")
.build();Implementations§
Source§impl DocsConfig
impl DocsConfig
Sourcepub fn new(
nav_json: &str,
content_map: HashMap<&'static str, &'static str>,
) -> Self
pub fn new( nav_json: &str, content_map: HashMap<&'static str, &'static str>, ) -> Self
Create a new builder from a _nav.json string and a content map.
The content map is typically generated by build.rs using include_str!().
Sourcepub fn with_openapi(self, prefix: &str, yaml: &str) -> Self
pub fn with_openapi(self, prefix: &str, yaml: &str) -> Self
Add an OpenAPI specification.
prefix: The URL prefix for this spec’s endpoints (e.g. “api-reference”).yaml: The raw YAML string of the OpenAPI spec.
The prefix must correspond to a nav group in _nav.json whose "group" value
matches Self::with_api_group_name (defaults to "API Reference"). The library
dynamically injects API endpoints into that group’s sidebar — do not list
individual operation paths in the "pages" array of _nav.json.
Sourcepub fn with_default_path(self, path: &str) -> Self
pub fn with_default_path(self, path: &str) -> Self
Set the default documentation path for redirects.
Defaults to the first page in the first nav group if not set.
Sourcepub fn with_api_group_name(self, name: &str) -> Self
pub fn with_api_group_name(self, name: &str) -> Self
Set the display name for the API Reference sidebar group.
Defaults to "API Reference". The value must match a "group" in _nav.json
so the library knows where to inject the API endpoint sidebar entries.
See Self::with_openapi for details.
Sourcepub fn with_theme(self, theme: &str) -> Self
pub fn with_theme(self, theme: &str) -> Self
Set a single theme (no toggle button).
The theme name must match a DaisyUI theme defined in the consumer’s tailwind.css.
Sourcepub fn with_theme_toggle(self, light: &str, dark: &str, default: &str) -> Self
pub fn with_theme_toggle(self, light: &str, dark: &str, default: &str) -> Self
Enable a light/dark theme toggle.
light: Name of the light DaisyUI theme.dark: Name of the dark DaisyUI theme.default: Which of the two to use on first visit (lightordark).
Sourcepub fn build(self) -> DocsRegistry
pub fn build(self) -> DocsRegistry
Build the DocsRegistry.
Parses all documents, builds the search index, and parses OpenAPI specs.