PeerTube icon indicating copy to clipboard operation
PeerTube copied to clipboard

ActivityPub: `content` is not HTML

Open rinpatch opened this issue 5 years ago • 9 comments

What happened? content of an object found at https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe uses \n for newlines.

What do you expect to happen instead?

To use <br> for newlines since content should be HTML according to https://www.w3.org/TR/activitystreams-vocabulary/#dfn-content Steps to reproduce:

  1. curl -H "Accept: application/activity+json" https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe | jq .content

Additional information

  • PeerTube version or URL: https://peertube.social

rinpatch avatar Feb 13 '20 20:02 rinpatch

We use markdown for the content field, and we set mediaType to text/markdown:

  "mediaType": "text/markdown",
  "content": "Support this and our other Michigan!/usr/group videos and meetings. Learn more at http://mug.org/membership\n\nTwenty Years in Jail: FreeBSD's Jails, Then and Now\n\nJails started as a limited virtualization system, but over the last two years they've...",

Chocobozzz avatar Feb 14 '20 08:02 Chocobozzz

Ah apologies, for some reason I forgot that it's possible to set an alternative content type without using contentMap, feel free to close then

rinpatch avatar Feb 14 '20 12:02 rinpatch

But it could be interesting to put HTML since I don't think other federated platforms includes a markdown parser in their server or front end. Reopening for discussion if other developers have issues with our markdown.

Chocobozzz avatar Feb 14 '20 12:02 Chocobozzz

Well in case of Pleroma we already include a markdown parser in the backend, so it's not really a problem for us. But having HTML might be better for interoperability indeed.

You could do it like Friendica and have HTML in content and markdown in contentMap for servers/clients that understand it:

      "content": "@<span class=\"vcard\"><a href=\"https://zap.dog/channel/wago\" class=\"url u-url mention\" title=\"wago\"><span class
=\"fn nickname mention\">wago</span></a></span> I think somebody's phone, browser, or internet connection is not doing them any favours.
  The site doesn't produce any junk for me on mobile or desktop. <br><br>Also Mike, your comment didn't make it to zap.dog - or, it's hi
dden somehow.",
      "contentMap": {
        "text/html": "I think somebody's phone, browser, or internet connection is not doing them any favours.  The site doesn't produce
 any junk for me on mobile or desktop. <br><br>Also Mike, your comment didn't make it to zap.dog - or, it's hidden somehow.",
        "text/markdown": "I think somebody's phone, browser, or internet connection is not doing them any favours. The site doesn't produce any junk for me on mobile or desktop. \n\nAlso Mike, your comment didn't make it to zap.dog - or, it's hidden somehow."
      }

(taken from https://social.isurf.ca/objects/c443a55c-305e-4619-ab20-45c176316901 )

rinpatch avatar Feb 14 '20 14:02 rinpatch

Well in case of Pleroma we already include a markdown parser in the backend, so it's not really a problem for us. But having HTML might be better for interoperability indeed.

You could do it like Friendica and have HTML in content and markdown in contentMap for servers/clients that understand it:

      "content": "@<span class=\"vcard\"><a href=\"https://zap.dog/channel/wago\" class=\"url u-url mention\" title=\"wago\"><span class
=\"fn nickname mention\">wago</span></a></span> I think somebody's phone, browser, or internet connection is not doing them any favours.
  The site doesn't produce any junk for me on mobile or desktop. <br><br>Also Mike, your comment didn't make it to zap.dog - or, it's hi
dden somehow.",
      "contentMap": {
        "text/html": "I think somebody's phone, browser, or internet connection is not doing them any favours.  The site doesn't produce
 any junk for me on mobile or desktop. <br><br>Also Mike, your comment didn't make it to zap.dog - or, it's hidden somehow.",
        "text/markdown": "I think somebody's phone, browser, or internet connection is not doing them any favours. The site doesn't produce any junk for me on mobile or desktop. \n\nAlso Mike, your comment didn't make it to zap.dog - or, it's hidden somehow."
      }

(taken from https://social.isurf.ca/objects/c443a55c-305e-4619-ab20-45c176316901 )

This is a problem for Pleroma, see #2450 which I opened (same issue).

busshimoe avatar Feb 18 '20 18:02 busshimoe

Sorry I did not remember there was already an issue. Thanks @busshimoe

Chocobozzz avatar Feb 19 '20 08:02 Chocobozzz

Any update on this one? Also descriptions should probably not be truncated, pleroma has a good support for long content and mastodon does so for quite a while now.

lanodan avatar May 25 '20 11:05 lanodan

Any update on this one?

No sorry, I won't have time to implement this in the near future.

Chocobozzz avatar Jun 04 '20 13:06 Chocobozzz

Any update on this one? Also descriptions should probably not be truncated, pleroma has a good support for long content and mastodon does so for quite a while now.

Not only that but Mastodon can even put longer text behind a "Show more". This would be ideal for video descriptions.

gelbphoenix avatar Jul 09 '25 22:07 gelbphoenix