Skip to content

AP: try marking up @-mentions in content with semantic HTML #887

Open
@snarfed

Description

Mastodon understands which links in a given post are @-mentions and rewrites them to point to the local instance. Example: https://ohai.social/@lutoma/111947244364291173 . The first reply there from me is via Bridgy Fed, which has @-mention links that don't get that rewriting.

The only differences I see between the two posts' AS2 is that Mastodon's tag.names are fuly qualified, eg @mmu_man@m.g3l.org, while BF's are only @mmu_man, and that Mastodon's a tags in content have class="u-url mention". Not sure which matters, or both, or something else:

Mastodon AS2 object:

{
  "type": "Note",
  "id": "https://ohai.social/users/lutoma/statuses/111947244364291173",
  "url": "https://ohai.social/@lutoma/111947244364291173",
  "inReplyTo": "https://m.g3l.org/users/mmu_man/statuses/111947239114557378",
  "published": "2024-02-17T14:16:27Z",
  "attributedTo": "https://ohai.social/users/lutoma",
  "to": ["https://www.w3.org/ns/activitystreams#Public"]
  "cc": [
    "https://ohai.social/users/lutoma/followers",
    "https://m.g3l.org/users/mmu_man",
    "https://abyssdomain.expert/users/filippo"
  ],
  "content": "<p><span class=\"h-card\" translate=\"no\"><a href=\"https://m.g3l.org/@mmu_man\" class=\"u-url mention\">@<span>mmu_man</span></a></span> <span class=\"h-card\" translate=\"no\"><a href=\"https://abyssdomain.expert/@filippo\" class=\"u-url mention\">@<span>filippo</span></a></span> social.vivaldi.net is run by a for-profit entity. There&#39;s probably a few other ones as well.</p>",
  "tag": [{
      "type": "Mention",
      "href": "https://m.g3l.org/users/mmu_man",
      "name": "@mmu_man@m.g3l.org"
    }, {
      "type": "Mention",
      "href": "https://abyssdomain.expert/users/filippo",
      "name": "@filippo@abyssdomain.expert"
    }],
  "..."
}

BF AS2 object:

{
   "@context" : "https://www.w3.org/ns/activitystreams",
   "type" : "Note",
   "id" : "https://fed.brid.gy/r/https://snarfed.org/2024-02-18_lutoma-ohai-mmu_man-filippo-social-vival-ohai-social",
   "url" : "https://fed.brid.gy/r/https://snarfed.org/2024-02-18_lutoma-ohai-mmu_man-filippo-social-vival-ohai-social"
   "attributedTo" : "https://fed.brid.gy/snarfed.org",
   "to" : ["https://www.w3.org/ns/activitystreams#Public"],
   "cc" : [
      "https://abyssdomain.expert/@filippo",
      "https://m.g3l.org/@mmu_man"
   ],
   "content" : "<a class=\"u-in-reply-to\" href=\"https://ohai.social/@lutoma/111947244364291173\"></a>\n<div class=\"e-content\">\n<a href=\"https://abyssdomain.expert/@filippo\">@filippo</a> <a href=\"https://m.g3l.org/@mmu_man\">@mmu_man</a>\n<p>Yup, many. <a href=\"https://me.dm/\">me.dm</a>, <a href=\"https://flipboard.social/\">flipboard.social</a> and soon <a href=\"https://flipboard.com/\">flipboard.com</a>, <a href=\"https://1password.social/\">1password.social</a>, <a href=\"https://dnsimple.social\">dnsimple.social</a>, among others.</p>\n</div>",
   "inReplyTo" : "https://ohai.social/@lutoma/111947244364291173",
   "published" : "2024-02-18T10:05:50-08:00",
   "tag" : [{
         "href" : "https://abyssdomain.expert/@filippo",
         "name" : "@filippo",
         "type" : "Mention"
      }, {
         "href" : "https://m.g3l.org/@mmu_man",
         "name" : "@mmu_man",
         "type" : "Mention"
      }],
}

Metadata

Assignees

No one assigned

    Labels

    compatProtocol differences that need special handling.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions