1 defmodule Pleroma.HTML.Scrubber.TwitterText do
3 An HTML scrubbing policy which limits to twitter-style text. Only
4 paragraphs, breaks and links are allowed through the filter.
7 @valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
9 require FastSanitize.Sanitizer.Meta
10 alias FastSanitize.Sanitizer.Meta
15 Meta.allow_tag_with_uri_attributes(:a, ["href", "data-user", "data-tag"], @valid_schemes)
17 Meta.allow_tag_with_this_attribute_values(:a, "class", [
25 Meta.allow_tag_with_this_attribute_values(:a, "rel", [
32 Meta.allow_tag_with_these_attributes(:a, ["name", "title"])
34 # paragraphs and linebreaks
35 Meta.allow_tag_with_these_attributes(:br, [])
36 Meta.allow_tag_with_these_attributes(:p, [])
39 Meta.allow_tag_with_this_attribute_values(:span, "class", ["h-card"])
40 Meta.allow_tag_with_these_attributes(:span, [])
42 # allow inline images for custom emoji
43 if Pleroma.Config.get([:markup, :allow_inline_images]) do
44 # restrict img tags to http/https only, because of MediaProxy.
45 Meta.allow_tag_with_uri_attributes(:img, ["src"], ["http", "https"])
47 Meta.allow_tag_with_these_attributes(:img, [
56 Meta.strip_everything_not_covered()