unimarkup_render/render.rs
1//! Contains the [`Render`] trait definition.
2
3use crate::html::Html;
4use logid::capturing::MappedLogId;
5
6/// Abstract type for Unimarkup elements that implement the [`Render`] trait
7pub type RenderBlock = Box<dyn Render>;
8
9/// Trait to provide render implementation for supported output formats
10pub trait Render {
11 /// Generates the HTML representation of an Unimarkup element.
12 ///
13 /// Returns a [`MappedLogId`] if it's not possible to generate valid HTML, i.e. if
14 /// provided id contains characters not allowed in HTML id attribute.
15 fn render_html(&self) -> Result<Html, MappedLogId>;
16}