pub struct DocsRegistry {
pub nav: NavConfig,
pub default_path: String,
pub api_group_name: String,
pub theme: Option<ThemeConfig>,
pub code_theme: CodeThemeConfig,
/* private fields */
}Expand description
Central documentation registry holding all parsed content.
Created via DocsConfig builder and typically stored in a Lazy<DocsRegistry> static.
Provide it to UI components via use_context_provider(|| &*DOCS as &'static DocsRegistry).
Fields§
Navigation configuration.
default_path: StringDefault page path for redirects.
api_group_name: StringDisplay name for the API Reference sidebar group.
theme: Option<ThemeConfig>Optional theme configuration.
code_theme: CodeThemeConfigSyntax-highlighting theme for code blocks.
Implementations§
Source§impl DocsRegistry
impl DocsRegistry
Sourcepub fn get_parsed_doc(&self, path: &str) -> Option<&ParsedDoc>
pub fn get_parsed_doc(&self, path: &str) -> Option<&ParsedDoc>
Get a pre-parsed document by path.
Get the sidebar title for a documentation path.
Sourcepub fn get_doc_title(&self, path: &str) -> Option<String>
pub fn get_doc_title(&self, path: &str) -> Option<String>
Get the document title from frontmatter.
Sourcepub fn get_page_title(&self, path: &str) -> Option<String>
pub fn get_page_title(&self, path: &str) -> Option<String>
Get the page title for the document <head>.
Resolves MDX frontmatter titles and OpenAPI operation pages (which are
not in parsed_docs): for an endpoint path it returns the operation
summary, falling back to a humanised slug. Branding/suffixes are left to
the caller.
Sourcepub fn get_page_description(&self, path: &str) -> Option<String>
pub fn get_page_description(&self, path: &str) -> Option<String>
Get the meta description for the document <head>.
Resolves MDX frontmatter descriptions and OpenAPI operation
descriptions, so endpoint pages ship a unique <meta name="description">
instead of falling through to a generic default.
Sourcepub fn get_doc_icon(&self, path: &str) -> Option<String>
pub fn get_doc_icon(&self, path: &str) -> Option<String>
Get the icon for a documentation path from frontmatter.
Sourcepub fn get_doc_content(&self, path: &str) -> Option<&str>
pub fn get_doc_content(&self, path: &str) -> Option<&str>
Get raw documentation content by path.
Sourcepub fn get_all_paths(&self) -> Vec<&str>
pub fn get_all_paths(&self) -> Vec<&str>
Get all available documentation paths.
Sourcepub fn get_api_operation(&self, path: &str) -> Option<&ApiOperation>
pub fn get_api_operation(&self, path: &str) -> Option<&ApiOperation>
Look up an API operation by its slug across all registered specs.
The path is the full docs path, e.g. “api-reference/list-pets”.
Sourcepub fn get_api_operation_with_spec(
&self,
path: &str,
) -> Option<(&ApiOperation, &OpenApiSpec)>
pub fn get_api_operation_with_spec( &self, path: &str, ) -> Option<(&ApiOperation, &OpenApiSpec)>
Look up an API operation together with the spec that owns it.
Use this instead of pairing Self::get_api_operation with
Self::get_first_api_spec — with multiple registered specs, the
first spec is not necessarily the one the operation belongs to.
Sourcepub fn get_api_spec(&self, prefix: &str) -> Option<&OpenApiSpec>
pub fn get_api_spec(&self, prefix: &str) -> Option<&OpenApiSpec>
Get the OpenAPI spec that owns a given path prefix.
Sourcepub fn get_first_api_spec(&self) -> Option<&OpenApiSpec>
pub fn get_first_api_spec(&self) -> Option<&OpenApiSpec>
Get the first OpenAPI spec (convenience for single-spec setups).
Sourcepub fn get_first_api_prefix(&self) -> Option<&str>
pub fn get_first_api_prefix(&self) -> Option<&str>
Get the prefix of the first OpenAPI spec.
Get API endpoint sidebar entries grouped by tag (precomputed).
Sourcepub fn get_api_endpoint_paths(&self) -> Vec<String>
pub fn get_api_endpoint_paths(&self) -> Vec<String>
Get all API endpoint paths for navigation ordering.
Sourcepub fn tab_for_path(&self, path: &str) -> Option<String>
pub fn tab_for_path(&self, path: &str) -> Option<String>
Determine which tab a given page path belongs to.
Sourcepub fn generate_llms_txt(
&self,
site_title: &str,
site_description: &str,
docs_base_url: &str,
) -> String
pub fn generate_llms_txt( &self, site_title: &str, site_description: &str, docs_base_url: &str, ) -> String
Generate an llms.txt index listing all doc pages with titles and descriptions.
docs_base_url is the absolute URL of the docs root, e.g.
"https://example.com/docs"; page URLs are formed as
<docs_base_url>/<page>.
Sourcepub fn generate_llms_full_txt(
&self,
site_title: &str,
site_description: &str,
docs_base_url: &str,
) -> String
pub fn generate_llms_full_txt( &self, site_title: &str, site_description: &str, docs_base_url: &str, ) -> String
Generate an llms-full.txt with the full MDX content of every doc page.
See Self::generate_llms_txt for the docs_base_url format.
Sourcepub fn generate_sitemap(&self, site_url: &str, docs_path: &str) -> String
pub fn generate_sitemap(&self, site_url: &str, docs_path: &str) -> String
Generate a sitemap.xml for all documentation pages.
Sourcepub fn search_docs(&self, query: &str) -> Vec<&SearchEntry>
pub fn search_docs(&self, query: &str) -> Vec<&SearchEntry>
Search documentation by query string.
Splits the query on whitespace and returns section-level entries whose
fields all match every term (multi-term AND), ranked title > heading >
description > body with a word-boundary bonus. See [crate::search].