Skip to main content

Module render

Module render 

Source
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§

CleanupOptions
Cleanup options for post-processing.
RenderOptions
Options for rendering documents.

Enums§

CleanupPreset
Cleanup preset for LLM training data preparation.
JsonFormat
JSON output format options.
TableFallback
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.