Struct ammonia::Ammonia [] [src]

pub struct Ammonia<'a> {
    pub tags: HashSet<&'a str>,
    pub tag_attributes: HashMap<&'a str, HashSet<&'a str>>,
    pub generic_attributes: HashSet<&'a str>,
    pub url_schemes: HashSet<&'a str>,
    pub url_relative: bool,
    pub strip: bool,
    pub strip_comments: bool,
}

Settings for HTML cleaning.

Fields

Tags that are allowed. Note that this only whitelists the tag; it will still be stripped if it has unlisted attributes.

Attributes that are allowed on certain tags. If the tag is not itself whitelisted, adding entries to this map do nothing. It is structured as a map from tag name to set of attribute name.

Attributes that are allowed on any tag.

Permitted URL schemes on href and src attributes.

Permit relative URLs on href and src attributes.

True: do not include stripped tags. False: escape stripped tags.

True: strip HTML comments. False: leave HTML comments in.

Methods

impl<'a> Ammonia<'a>
[src]

Given a fragment of HTML, Ammonia will parse it according to the HTML5 parsing algorithm and sanitize any disallowed tags or attributes. This algorithm also takes care of things like unclosed and (some) misnested tags.

Trait Implementations

impl<'a> Default for Ammonia<'a>
[src]

Returns the "default value" for a type. Read more