Trait markdown_it::Renderer
source · pub trait Renderer {
// Required methods
fn open(&mut self, tag: &str, attrs: &[(&str, String)]);
fn close(&mut self, tag: &str);
fn self_close(&mut self, tag: &str, attrs: &[(&str, String)]);
fn contents(&mut self, nodes: &[Node]);
fn cr(&mut self);
fn text(&mut self, text: &str);
fn text_raw(&mut self, text: &str);
fn ext(&mut self) -> &mut RenderExtSet;
}Expand description
Each node outputs its HTML using this API.
Renderer is a struct that walks through AST and collects HTML from each node into internal buffer.
Required Methods§
sourcefn open(&mut self, tag: &str, attrs: &[(&str, String)])
fn open(&mut self, tag: &str, attrs: &[(&str, String)])
Write opening html tag with attributes, e.g. <a href="url">.
sourcefn self_close(&mut self, tag: &str, attrs: &[(&str, String)])
fn self_close(&mut self, tag: &str, attrs: &[(&str, String)])
Write self-closing html tag with attributes, e.g. <img src="url"/>.
sourcefn cr(&mut self)
fn cr(&mut self)
Write line break (\n). Default renderer ignores it if last char in the buffer is \n already.
sourcefn ext(&mut self) -> &mut RenderExtSet
fn ext(&mut self) -> &mut RenderExtSet
Extension set to store custom stuff.