Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
12.9k stars 1.48k forks source link

ActivityPub: `content` is not HTML #2488

Open rinpatch opened 4 years ago

rinpatch commented 4 years ago

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

Chocobozzz commented 4 years ago

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...",
rinpatch commented 4 years ago

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

Chocobozzz commented 4 years ago

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.

rinpatch commented 4 years ago

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 )

busshimoe commented 4 years ago

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).

Chocobozzz commented 4 years ago

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

lanodan commented 4 years ago

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.

Chocobozzz commented 4 years ago

Any update on this one?

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