Struct hoedown::renderer::html::Html
[−]
[src]
pub struct Html { /* fields omitted */ }
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>");
Methods
impl Html
[src]
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.
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.
fn get(&self) -> &hoedown_renderer
Get a reference to the underlying hoedown renderer
fn as_mut(&mut self) -> &mut hoedown_renderer
Get a mutable reference to the underlying hoedown renderer
Trait Implementations
impl Render for Html
[src]
unsafe fn to_hoedown(&mut self) -> hoedown_renderer
Converts the type into an underlying hoedown_renderer
structure. Read more
fn code_block(
&mut self,
ob: &mut Buffer,
text: Option<&Buffer>,
lang: Option<&Buffer>
)
&mut self,
ob: &mut Buffer,
text: Option<&Buffer>,
lang: Option<&Buffer>
)
Runs when a codeblock is encountered Read more
fn quote_block(&mut self, ob: &mut Buffer, content: Option<&Buffer>)
Runs when a block quote is encountered Read more
fn header(&mut self, ob: &mut Buffer, content: Option<&Buffer>, level: i32)
Runs when a header is encountered Read more
fn horizontal_rule(&mut self, ob: &mut Buffer)
Runs when a horizontal rule is encountered Read more
fn list(&mut self, ob: &mut Buffer, content: Option<&Buffer>, flags: List)
Runs when a list is encountered. Read more
fn list_item(&mut self, ob: &mut Buffer, content: Option<&Buffer>, flags: List)
Runs when a list item is encountered. Read more
fn paragraph(&mut self, ob: &mut Buffer, content: Option<&Buffer>)
Runs when a paragraph is encountered. Read more
fn table(&mut self, ob: &mut Buffer, content: Option<&Buffer>)
Runs when a table is encountered. Read more
fn table_header(&mut self, ob: &mut Buffer, content: Option<&Buffer>)
Runs when a table header is encountered. Read more
fn table_body(&mut self, ob: &mut Buffer, content: Option<&Buffer>)
Runs when a table body is encountered. Read more
fn table_row(&mut self, ob: &mut Buffer, content: Option<&Buffer>)
Runs when a table row is encountered. Read more
fn table_cell(
&mut self,
ob: &mut Buffer,
content: Option<&Buffer>,
flags: Table
)
&mut self,
ob: &mut Buffer,
content: Option<&Buffer>,
flags: Table
)
Runs when a table cell is encountered. Read more
fn footnotes(&mut self, ob: &mut Buffer, content: Option<&Buffer>)
Runs when footnotes are encountered. Read more
fn footnote_definition(
&mut self,
ob: &mut Buffer,
content: Option<&Buffer>,
num: u32
)
&mut self,
ob: &mut Buffer,
content: Option<&Buffer>,
num: u32
)
Runs when a footnote definition is encountered. Read more
fn html_block(&mut self, ob: &mut Buffer, text: Option<&Buffer>)
Runs when a raw html block is encountered. Read more
fn autolink(
&mut self,
ob: &mut Buffer,
link: Option<&Buffer>,
ty: AutoLink
) -> bool
&mut self,
ob: &mut Buffer,
link: Option<&Buffer>,
ty: AutoLink
) -> bool
Runs when an autolink candidate is encountered. Read more
fn code_span(&mut self, ob: &mut Buffer, text: Option<&Buffer>) -> bool
Runs when a code span is encountered. Read more
fn double_emphasis(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when double emphasis is encountered. Read more
fn emphasis(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when emphasis is encountered. Read more
fn underline(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when underline is encountered. Read more
fn highlight(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when highlight is encountered. Read more
fn quote_span(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when a quote is encountered. Read more
fn image(
&mut self,
ob: &mut Buffer,
link: Option<&Buffer>,
title: Option<&Buffer>,
alt: Option<&Buffer>
) -> bool
&mut self,
ob: &mut Buffer,
link: Option<&Buffer>,
title: Option<&Buffer>,
alt: Option<&Buffer>
) -> bool
Runs when an image is encountered. Read more
fn line_break(&mut self, ob: &mut Buffer) -> bool
Runs when a line break is encountered. Read more
fn link(
&mut self,
ob: &mut Buffer,
content: Option<&Buffer>,
link: Option<&Buffer>,
title: Option<&Buffer>
) -> bool
&mut self,
ob: &mut Buffer,
content: Option<&Buffer>,
link: Option<&Buffer>,
title: Option<&Buffer>
) -> bool
Runs when a link is encountered. Read more
fn triple_emphasis(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when triple emphasis is encountered. Read more
fn strikethrough(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when strikethrough is encountered. Read more
fn superscript(&mut self, ob: &mut Buffer, content: Option<&Buffer>) -> bool
Runs when superscript is encountered. Read more
fn footnote_reference(&mut self, ob: &mut Buffer, num: u32) -> bool
Runs when a footnote reference is encountered. Read more
fn math(
&mut self,
ob: &mut Buffer,
text: Option<&Buffer>,
displaymode: i32
) -> bool
&mut self,
ob: &mut Buffer,
text: Option<&Buffer>,
displaymode: i32
) -> bool
Runs when math is encountered. Read more
fn html_span(&mut self, ob: &mut Buffer, text: Option<&Buffer>) -> bool
Runs when raw html span is encountered. Read more
fn entity(&mut self, ob: &mut Buffer, text: Option<&Buffer>)
Runs when an html entity is encountered. Read more
fn normal_text(&mut self, ob: &mut Buffer, text: Option<&Buffer>)
Runs when plain text is encountered. Read more
fn before_render(&mut self, ob: &mut Buffer, inline_render: bool)
Runs before the document is processed. Read more
fn after_render(&mut self, ob: &mut Buffer, inline_render: bool)
Runs after the document has been processed. Read more
fn render(&mut self, input: &Markdown) -> Buffer
Render the document to a buffer that is returned
fn render_to(&mut self, input: &Markdown, output: &mut Buffer)
Render the document into the given buffer
fn render_inline(&mut self, input: &Markdown) -> Buffer
Render the document as inline to a buffer that is returned
fn render_inline_to(&mut self, input: &Markdown, output: &mut Buffer)
Render the document as inline into the given buffer