Skip to content

plissken-core::render::ssg::traits

Rust

SSG adapter trait definition

pub

Entry for a module in the navigation

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

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

fn name(&self) -> &'static str

Human-readable name for the SSG.

Source
fn name(&self) -> &'static str;
fn content_dir(&self) -> &'static str

Directory where content files are placed (relative to output root).

  • MkDocs: "docs"
  • mdBook: "src"
Source
fn content_dir(&self) -> &'static str;
fn nav_filename(&self) -> &'static str

Navigation file name.

  • MkDocs: "_nav.yml" (included in mkdocs.yml)
  • mdBook: "SUMMARY.md"
Source
fn nav_filename(&self) -> &'static str;
fn generate_nav(
&self,
python_modules: &[PythonModule],
rust_modules: &[RustModule],
) -> String

Generate 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;
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>;
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
}
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
}
fn content_extension(&self) -> &'static str

File extension for content files.

Source
fn content_extension(&self) -> &'static str {
"md"
}
fn supports_nested_nav(&self) -> bool

Whether this SSG supports nested/hierarchical navigation.

Source
fn supports_nested_nav(&self) -> bool {
true
}

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()
}

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()
}