1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.NormalizeMarkup do
6 @moduledoc "Scrub configured hypertext markup"
9 @behaviour Pleroma.Web.ActivityPub.MRF.Policy
12 def filter(%{"type" => "Create", "object" => child_object} = object) do
13 scrub_policy = Pleroma.Config.get([:mrf_normalize_markup, :scrub_policy])
16 child_object["content"]
17 |> HTML.filter_tags(scrub_policy)
19 object = put_in(object, ["object", "content"], content)
24 def filter(object), do: {:ok, object}
27 def describe, do: {:ok, %{}}
30 def config_description do
32 key: :mrf_normalize_markup,
33 related_policy: "Pleroma.Web.ActivityPub.MRF.NormalizeMarkup",
34 label: "MRF Normalize Markup",
35 description: "MRF NormalizeMarkup settings. Scrub configured hypertext markup.",
40 suggestions: [Pleroma.HTML.Scrubber.Default]