Expand description
Output rendering for documents.
This module provides renderers for converting Document models to various output formats: Markdown, plain text, and JSON.
§Example
use undoc::{parse_file, render::*};
let doc = parse_file("document.docx")?;
// Render to Markdown
let md = to_markdown(&doc, &RenderOptions::default())?;
// Render to plain text
let text = to_text(&doc, &RenderOptions::default())?;
// Render to JSON
let json = to_json(&doc, JsonFormat::Pretty)?;Re-exports§
pub use heading_analyzer::DocumentStats;pub use heading_analyzer::HeadingAnalyzer;pub use heading_analyzer::HeadingConfig;pub use heading_analyzer::HeadingDecision;pub use style_mapping::StyleMapping;
Modules§
- heading_
analyzer - Sophisticated heading detection with multi-level priority analysis.
- style_
mapping - Style name to heading level mapping.
Structs§
- Cleanup
Options - Cleanup options for post-processing.
- Render
Options - Options for rendering documents.
Enums§
- Cleanup
Preset - Cleanup preset for LLM training data preparation.
- Json
Format - JSON output format options.
- Table
Fallback - How to render complex tables.
Functions§
- clean_
text - Clean text according to the provided options.
- detect_
mojibake - Detect potential mojibake patterns (for reporting, not fixing).
- to_json
- Convert a Document to JSON.
- to_
json_ default - Convert a Document to JSON with default formatting.
- to_
json_ with_ options - Convert a Document to JSON with render options (for consistency).
- to_
markdown - Convert a Document to Markdown.
- to_text
- Convert a Document to plain text.