1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Output rendering for the conversion pipeline.
//!
//! This module defines the [`Renderer`] trait and provides the built-in
//! [`MarkdownRenderer`]. Implement `Renderer` to produce custom output formats
//! (HTML, plain text, or a custom Markdown dialect) and pass it to
//! [`DocxToMarkdown::with_components`](crate::DocxToMarkdown::with_components).
use crateDocumentAst;
use crateResult;
pub use ;
pub use MarkdownRenderer;
/// Serializes a [`DocumentAst`] into a final output string.
///
/// The default implementation is [`MarkdownRenderer`]. To use a custom renderer,
/// pass it to [`DocxToMarkdown::with_components`](crate::DocxToMarkdown::with_components).
///
/// # Implementing
///
/// ```no_run
/// use undocx::core::ast::DocumentAst;
/// use undocx::render::Renderer;
/// use undocx::Result;
///
/// struct PlainTextRenderer;
///
/// impl Renderer for PlainTextRenderer {
/// fn render(&self, document: &DocumentAst) -> Result<String> {
/// // Custom rendering logic here
/// Ok(String::new())
/// }
/// }
/// ```
///
/// # Errors
///
/// Returns [`Error`](crate::Error) if rendering fails.