rsmarkdown_core/renderer.rs
1//! The core/display seam. Display adapters (TUI, web, etc.) implement
2//! [`Renderer`]; the core never depends on any display library.
3
4use crate::processor::Document;
5
6/// Display-layer contract. The adapter decides how to paint the AST.
7///
8/// Implementations are free to diff against their previous input to re-render
9/// only the changed blocks (the TUI adapter does exactly that).
10pub trait Renderer {
11 /// Render (or update) the given document.
12 fn render(&mut self, doc: &Document);
13}
14
15/// A renderer that produces no output — useful as a benchmark baseline.
16pub struct NullRenderer;
17
18impl Renderer for NullRenderer {
19 fn render(&mut self, _doc: &Document) {}
20}