Trait comrak::adapters::HeadingAdapter
source · pub trait HeadingAdapter: Send + Sync {
// Required methods
fn enter(
&self,
output: &mut dyn Write,
heading: &HeadingMeta,
sourcepos: Option<Sourcepos>
) -> Result<()>;
fn exit(&self, output: &mut dyn Write, heading: &HeadingMeta) -> Result<()>;
}
Expand description
Implement this adapter for creating a plugin for custom headings (h1
, h2
, etc.). The enter
method defines what’s rendered prior the AST content of the heading while the exit
method
defines what’s rendered after it. Both methods provide access to a HeadingMeta
struct and
leave the AST content of the heading unchanged.