Skip to main content

HtmlPolicy

Trait HtmlPolicy 

Source
pub trait HtmlPolicy {
    // Required methods
    fn element(&self, name: &str) -> ElementAction;
    fn attribute<'v>(
        &self,
        element: &str,
        name: &str,
        value: &'v str,
    ) -> Option<Cow<'v, str>>;
    fn destination<'u>(&self, url: &'u str, image: bool) -> Option<Cow<'u, str>>;
}
Expand description

Decides what of raw HTML and link destinations gets into the rendered tree.

Required Methods§

Source

fn element(&self, name: &str) -> ElementAction

What happens to an element of raw HTML. The name is lowercase.

Source

fn attribute<'v>( &self, element: &str, name: &str, value: &'v str, ) -> Option<Cow<'v, str>>

The value an attribute of a kept element gets — the same one or changed — or None, which drops the attribute. Names are lowercase and character references in values are already resolved (&#106; is j).

Source

fn destination<'u>(&self, url: &'u str, image: bool) -> Option<Cow<'u, str>>

The destination of a markdown link or image (image), autolinks included, or None, which leaves the link text without a link and the image replaced by its description.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§