module_renderer Rust¶
Module page rendering for Python and Rust documentation
This module provides rendering functionality for converting PythonModule
and RustModule structures into Markdown documentation files.
Structs¶
struct RenderedPage¶
pub
Derives: Debug, Clone
Rendered output for a documentation file
Fields¶
| Name | Type | Description |
|---|---|---|
path |
PathBuf |
Relative path for output (e.g., "my_module.md" or "rust/my_crate.md") |
content |
String |
The rendered Markdown content |
struct ModulePageBuilder¶
private
Builder for constructing module documentation pages.
This provides a common structure for both Python and Rust module pages,
reducing code duplication between render_python_module_inline and
render_rust_module_inline.
Fields¶
| Name | Type | Description |
|---|---|---|
content |
String |
Methods¶
new private¶
Create a new page builder
add_header private¶
Add the module header with a badge
Source
add_docstring private¶
Add a parsed docstring section
Source
add_section private¶
Add a section header (h2)
Source
add_item private¶
Add rendered item content with spacing
Source
add_variables_table private¶
fn add_variables_table < T , F > (& mut self , title : & str , items : & [T] , row_renderer : F) where F : Fn (& T) -> (String , String , String) ,
Add a variables/constants table
Source
fn add_variables_table<T, F>(&mut self, title: &str, items: &[T], row_renderer: F)
where
F: Fn(&T) -> (String, String, String), // (name, type, desc)
{
if items.is_empty() {
return;
}
self.content.push_str(&format!("## {}\n\n", title));
self.content.push_str("| Name | Type | Description |\n");
self.content.push_str("|------|------|-------------|\n");
for item in items {
let (name, ty, desc) = row_renderer(item);
self.content.push_str(&format!("| `{}` | `{}` | {} |\n", name, ty, desc));
}
self.content.push('\n');
}
build private¶
Build the final content
struct ModuleRenderer<'a>¶
pub
Module page renderer that converts DocModel modules into Markdown files.
Fields¶
| Name | Type | Description |
|---|---|---|
renderer |
& 'a Renderer |
|
linker |
CrossRefLinker |