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.11k stars 5.41k forks source link

asciinema in issues #26190

Open kousu opened 1 year ago

kousu commented 1 year ago

Feature Description

It is great that https://github.com/go-gitea/gitea/pull/22448 added support for rendering asciinema's .cast files when uploaded to a repo: :tada:

https://github.com/go-gitea/gitea/assets/987487/e9881e8b-464a-493e-b5d6-90fd37ea7e3c

It would be even better if they could be dropped into issues, the way we can currently drop screenshots. When debugging an issue, or proposing a PR, I find it incredibly useful that I can upload a video file to demonstrate exactly the issue. But being able to do the same with a .cast file would be stellar -- faster, and with the ability for people to copy command lines directly out of it.

Currently .cast files are not even allowed as attachments by default, but with attachments.ALLOWED_TYPES I was able to set

[attachment]
MAX_SIZE = 40
ALLOWED_TYPES = .cast,.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip

but they do not render:

Screenshot_20230727_150515 Screenshot_20230727_150520

It would be great if they did! asciinema.js is shipping with Gitea now so hopefully it should be an easy addition.

Screenshots

On GitHub, uploading a .mp4 as an attachment gets replaced by its uploaded link and rendered as a video player:

Screenshot_20230727_150304 Screenshot_20230727_150314

That's the workflow I would like to have for .cast files in Gitea if possible!

wolfogre commented 1 year ago

The main difficulty is how to embed asciinema player into the markdown file renderer. See https://github.com/go-gitea/gitea/pull/22448#issuecomment-1382694525

And it must be an elegant and scalable way, because others could also ask to render PDFs, videos or other files.

I'll be absolutely ecstatic someone finds a way to do that.

lunny commented 1 year ago

Both plain internal links and markdown image links could call renderers to render the content. According to the file name extension names, include PDF, asciinema, css, console log and etc renderers.