pub struct Html { /* private fields */ }
Expand description
HTML renderer
This can be used to render markdown documents to HTML. This
type can also be leveraged to create custom renderers that delegate
to the HTML renderer in certain cases, as shown in the Render
trait
documentation example.
let input = Buffer::from("EMPHASIZE");
let mut output = Buffer::new(64usize);
let mut html_renderer = Html::new(Flags::empty(), 0);
html_renderer.emphasis(&mut output, Some(&input));
assert_eq!(output.to_str().unwrap(), "<em>EMPHASIZE</em>");
Implementations§
Source§impl Html
impl Html
Sourcepub fn new(flags: Flags, nesting_level: i32) -> Html
pub fn new(flags: Flags, nesting_level: i32) -> Html
Construct a new html renderer given the provided html flags and table of contents nesting level.
The toc
method can be used to construct a table of contents renderer
which renders only the table of contents. The nesting_level
on this
method determines the maximum depth of headers to associate with the
table of contents.
For this reason, if a table of contents is going to be rendered, this
method’s nesting_level
argument should be the same as the one passed
to the toc
method.
Sourcepub fn toc(nesting_level: i32) -> Html
pub fn toc(nesting_level: i32) -> Html
Construct a table of contents renderer.
This renderer will only render the table of contents.
If you want to have the headers of the document specify id
attributes
so that the table of contents items link to the correct header, you should
render the document with the renderer returned by the new
method with the
same value for the nesting_level
parameter.
Sourcepub fn get(&self) -> &hoedown_renderer
pub fn get(&self) -> &hoedown_renderer
Get a reference to the underlying hoedown renderer
Sourcepub fn as_mut(&mut self) -> &mut hoedown_renderer
pub fn as_mut(&mut self) -> &mut hoedown_renderer
Get a mutable reference to the underlying hoedown renderer
Trait Implementations§
Source§impl Render for Html
impl Render for Html
Source§unsafe fn to_hoedown(&mut self) -> hoedown_renderer
unsafe fn to_hoedown(&mut self) -> hoedown_renderer
hoedown_renderer
structure. Read more