plissken-core::render::ssg::traits
Rust
SSG adapter trait definition
Structs
Section titled “Structs”struct NavEntry
Section titled “struct NavEntry”pub
Entry for a module in the navigation
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
path |
String |
Module path (dotted for Python, :: for Rust) |
file_path |
PathBuf |
File path for the documentation page |
depth |
usize |
Nesting depth for hierarchical display |
Traits
Section titled “Traits”trait SSGAdapter
Section titled “trait SSGAdapter”pub
Supertraits: Send + Sync
Adapter for static site generator output.
This trait abstracts the differences between static site generators, providing a unified interface for navigation generation, config files, and directory structure.
Implementors
MkDocsAdapter- For MkDocs with Material themeMdBookAdapter- For mdBookStarlightAdapter- For Astro Starlight
Methods
Section titled “Methods”fn name(&self) -> &'static strHuman-readable name for the SSG.
Source
fn name(&self) -> &'static str;content_dir
Section titled “content_dir”fn content_dir(&self) -> &'static strDirectory where content files are placed (relative to output root).
- MkDocs:
"docs" - mdBook:
"src"
Source
fn content_dir(&self) -> &'static str;nav_filename
Section titled “nav_filename”fn nav_filename(&self) -> &'static strNavigation file name.
- MkDocs:
"_nav.yml"(included in mkdocs.yml) - mdBook:
"SUMMARY.md"
Source
fn nav_filename(&self) -> &'static str;generate_nav
Section titled “generate_nav”fn generate_nav( &self, python_modules: &[PythonModule], rust_modules: &[RustModule],) -> StringGenerate navigation content from modules.
Returns the navigation content in the SSG’s expected format:
- MkDocs: YAML format for the
nav:section - mdBook: Markdown format for SUMMARY.md
Source
fn generate_nav(&self, python_modules: &[PythonModule], rust_modules: &[RustModule]) -> String;generate_config
Section titled “generate_config”fn generate_config( &self, title: &str, authors: &[String],) -> Option<String>Generate SSG config file content.
- MkDocs: Returns
None(mkdocs.yml typically pre-exists) - mdBook: Returns book.toml content
Source
fn generate_config(&self, title: &str, authors: &[String]) -> Option<String>;generate_custom_css
Section titled “generate_custom_css”fn generate_custom_css(&self) -> Option<String>Generate custom CSS for the SSG, if any.
Returns CSS content that should be added to customize the documentation appearance, or None if no custom CSS is needed.
Source
fn generate_custom_css(&self) -> Option<String> { None }custom_css_path
Section titled “custom_css_path”fn custom_css_path(&self) -> Option<&'static str>Path for custom CSS file, if generated.
- mdBook:
"theme/custom.css"
Source
fn custom_css_path(&self) -> Option<&'static str> { None }content_extension
Section titled “content_extension”fn content_extension(&self) -> &'static strFile extension for content files.
Source
fn content_extension(&self) -> &'static str { "md" }supports_nested_nav
Section titled “supports_nested_nav”fn supports_nested_nav(&self) -> boolWhether this SSG supports nested/hierarchical navigation.
Source
fn supports_nested_nav(&self) -> bool { true }Functions
Section titled “Functions”fn python_nav_entries
Section titled “fn python_nav_entries”pub
fn python_nav_entries(modules: &[PythonModule]) -> Vec<NavEntry>Generate sorted navigation entries for Python modules
Source
pub fn python_nav_entries(modules: &[PythonModule]) -> Vec<NavEntry> { let mut sorted: Vec<&PythonModule> = modules.iter().collect(); sorted.sort_by(|a, b| a.path.cmp(&b.path));
sorted .iter() .map(|m| NavEntry { path: m.path.clone(), file_path: python_module_page(&m.path), depth: m.path.matches('.').count(), }) .collect()}fn rust_nav_entries
Section titled “fn rust_nav_entries”pub
fn rust_nav_entries(modules: &[RustModule]) -> Vec<NavEntry>Generate sorted navigation entries for Rust modules
Source
pub fn rust_nav_entries(modules: &[RustModule]) -> Vec<NavEntry> { let mut sorted: Vec<&RustModule> = modules.iter().collect(); sorted.sort_by(|a, b| a.path.cmp(&b.path));
sorted .iter() .map(|m| NavEntry { path: m.path.clone(), file_path: rust_module_page(&m.path), depth: m.path.matches("::").count(), }) .collect()}