go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.59k stars 5.45k forks source link

Open Graph meta-tag with page description shows non-rendered markdown #28729

Open mature-woman opened 9 months ago

mature-woman commented 9 months ago

Feature Description

Write the generated markdown document to the innerText of this meta tag

Screenshots

What it looks like now on Discord: изображение

wxiaoguang commented 9 months ago

Related to #26876 (ps: #26876 only made the "git commit message" outputted like other contents, the issue contents have been in raw format for long time).

These contents are from og:description tag.

According to https://ogp.me/ : it doesn't define what kind of content the og:description should provide.

I don't have enough experiences in OpenGraph field.

Is there any standard to define the format? Is it the content provider (Gitea) 's duty to provide HTML contents, or is it the renderer (eg: Discord in you case) 's duty to render the markdown as HTML?

mature-woman commented 9 months ago

Related to #26876 (ps: #26876 only made the "git commit message" outputted like other contents, the issue contents have been in raw format for long time).

These contents are from og:description tag.

According to https://ogp.me/ : it doesn't define what kind of content the og:description should provide.

I don't have enough experiences in OpenGraph field.

Is there any standard to define the format? Is it the content provider (Gitea) 's duty to provide HTML contents, or is it the renderer (eg: Discord in you case) 's duty to render the markdown as HTML?

Since the official Open Graph site does not define a standard, it means plain text, right? All the sites I've seen use purely plain text. It is unlikely that Discord and other services will develop a content handler for meta tags (at least it is not safe to allow sites to render HTML code or other standards inside the Discord or Twitter interface), most likely it is even intentionally escaped.

At the moment, it is completely impossible to beautifully share a link to an issue on Twitter and Discord

I don’t know if op:decription is used for indexing in search results, since there is a separate html-tag for this. If the search crawler is understand the Open Graph meta tag, then markdown rendering is very NECESSARY.

(I use machine translation into English followed by editing)

mature-woman commented 9 months ago

I just now realized that converting markdown to plain text is impossible. This is due to different language constructs from this standard.

My suggestions:

  1. In the issue editing panel, add a field with a description
  2. Simply remove the og:description meta tag
mature-woman commented 9 months ago

This is what og:description looks like from github изображение

lunny commented 9 months ago

Looks like Github removed all Titles and images, links from markdown text.