[][src]Trait html2text::render::text_renderer::TextDecorator

pub trait TextDecorator {
    type Annotation: Eq + PartialEq + Debug + Clone + Default;
    fn decorate_link_start(&mut self, url: &str) -> (String, Self::Annotation);
fn decorate_link_end(&mut self) -> String;
fn decorate_em_start(&mut self) -> (String, Self::Annotation);
fn decorate_em_end(&mut self) -> String;
fn decorate_strong_start(&mut self) -> (String, Self::Annotation);
fn decorate_strong_end(&mut self) -> String;
fn decorate_strikeout_start(&mut self) -> (String, Self::Annotation);
fn decorate_strikeout_end(&mut self) -> String;
fn decorate_code_start(&mut self) -> (String, Self::Annotation);
fn decorate_code_end(&mut self) -> String;
fn decorate_preformat_first(&mut self) -> Self::Annotation;
fn decorate_preformat_cont(&mut self) -> Self::Annotation;
fn decorate_image(&mut self, title: &str) -> (String, Self::Annotation);
fn make_subblock_decorator(&self) -> Self;
fn finalise(self) -> Vec<TaggedLine<Self::Annotation>>; }

Allow decorating/styling text.

Associated Types

type Annotation: Eq + PartialEq + Debug + Clone + Default

An annotation which can be added to text, and which will be attached to spans of text.

Loading content...

Required methods

Return an annotation and rendering prefix for a link.

Return a suffix for after a link.

fn decorate_em_start(&mut self) -> (String, Self::Annotation)

Return an annotation and rendering prefix for em

fn decorate_em_end(&mut self) -> String

Return a suffix for after an em.

fn decorate_strong_start(&mut self) -> (String, Self::Annotation)

Return an annotation and rendering prefix for strong

fn decorate_strong_end(&mut self) -> String

Return a suffix for after an strong.

fn decorate_strikeout_start(&mut self) -> (String, Self::Annotation)

Return an annotation and rendering prefix for strikeout

fn decorate_strikeout_end(&mut self) -> String

Return a suffix for after an strikeout.

fn decorate_code_start(&mut self) -> (String, Self::Annotation)

Return an annotation and rendering prefix for code

fn decorate_code_end(&mut self) -> String

Return a suffix for after an code.

fn decorate_preformat_first(&mut self) -> Self::Annotation

Return an annotation for the initial part of a preformatted line

fn decorate_preformat_cont(&mut self) -> Self::Annotation

Return an annotation for a continuation line when a preformatted line doesn't fit.

fn decorate_image(&mut self, title: &str) -> (String, Self::Annotation)

Return an annotation and rendering prefix for a link.

fn make_subblock_decorator(&self) -> Self

Return a new decorator of the same type which can be used for sub blocks.

fn finalise(self) -> Vec<TaggedLine<Self::Annotation>>

Finish with a document, and return extra lines (eg footnotes) to add to the rendered text.

Loading content...

Implementors

impl TextDecorator for PlainDecorator[src]

impl TextDecorator for RichDecorator[src]

impl TextDecorator for TrivialDecorator[src]

Loading content...