semtex v0.2.0
Semtex
sanitize_str_fragment!(raw_html, config \\ %{"allowed_attributes" => %{"all_tags" => ["lang", "title"], "by_tag" => %{"a" => ["href", "hreflang"], "bdo" => ["dir"], "blockquote" => ["cite"], "col" => ["align", "char", "charoff", "span"], "colgroup" => ["align", "char", "charoff", "span"], "del" => ["cite", "datetime"], "hr" => ["align", "size", "width"], "img" => ["align", "alt", "height", "src", "width"], "ins" => ["cite", "datetime"], "ol" => ["start"], "q" => ["cite"], "table" => ["align", "char", "charoff", "summary"], "tbody" => ["align", "char", "charoff"], "td" => ["align", "char", "charoff", "colspan", "headers", "rowspan"], "tfoot" => ["align", "char", "charoff"], "th" => ["align", "char", "charoff", "colspan", "headers", "rowspan", "scope"], "thead" => ["align", "char", "charoff"], "tr" => ["align", "char", "charoff"]}}, "allowed_tags" => ["a", "abbr", "acronym", "area", "article", "aside", "b", "bdi", "bdo", "blockquote", "br", "caption", "center", "cite", "code", "col", "colgroup", "data", "dd", "del", "details", "dfn", "div", "dl", "dt", "em", "figcaption", "figure", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "i", "img", "ins", "kbd", "kbd", "li", "map", "mark", "nav", "ol", "p", "pre", "q", "rp", "rt", "rtc", "ruby", "s", "samp", "small", "span", "strike", "strong", "sub", "summary", "sup", "table", "tbody", "td", "th", "thead", "time", "tr", "tt", "u", "ul", "var", "wbr"], "allowed_url_scheme_attributes" => ["href", "src"], "allowed_url_schemes" => ["bitcoin", "ftp", "ftps", "geo", "http", "https", "im", "irc", "ircs", "magnet", "mailto", "mms", "mx", "news", "nntp", "openpgp4fpr", "sip", "sms", "smsto", "ssh", "tel", "url", "webcal", "wtai", "xmpp"], "anchor_rel_values" => ["noopener", "noreferrer", "nofollow"], "escape_serialization" => true, "strip_comments" => true, "url_encode_attributes" => ["href", "src"]})