1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 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
11 def filter(%{"type" => activity_type} = object) when activity_type == "Create" do
12 scrub_policy = Pleroma.Config.get([:mrf_normalize_markup, :scrub_policy])
14 child = object["object"]
18 |> HTML.filter_tags(scrub_policy)
20 child = Map.put(child, "content", content)
22 object = Map.put(object, "object", child)
27 def filter(object), do: {:ok, object}