+ # Misskey has an awful tendency to drop all custom formatting when it sends remotely
+ # So this basically reprocesses their MFM source
+ defp fix_misskey_content(
+ %{"source" => %{"mediaType" => "text/x.misskeymarkdown", "content" => content}} = object
+ )
+ when is_binary(content) do
+ mention_handler = fn nick, buffer, opts, acc ->
+ remote_mention_resolver(object, nick, buffer, opts, acc)
+ end
+
+ {linked, _, _} =
+ Utils.format_input(content, "text/x.misskeymarkdown", mention_handler: mention_handler)
+
+ Map.put(object, "content", linked)
+ end
+
+ defp fix_misskey_content(%{"_misskey_content" => content} = object) when is_binary(content) do
+ mention_handler = fn nick, buffer, opts, acc ->
+ remote_mention_resolver(object, nick, buffer, opts, acc)
+ end
+
+ {linked, _, _} =
+ Utils.format_input(content, "text/x.misskeymarkdown", mention_handler: mention_handler)