vps: forgejo README renderer doesn't expand github user-attachments video URLs #16
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
barrettruth/nix#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Markdown like:
renders correctly on github.com as an embedded
<video controls>element (auto-play, loop, inline-playable). Live example: https://github.com/barrettruth/vimdoc-language-server shows the playable video.On our forgejo self-host (
git.barrettruth.com), the same URL in the same README renders as a plain hyperlink:Live example: https://git.barrettruth.com/barrettruth/vimdoc-language-server shows the URL as text.
Why this matters
We just rolled out the v2
deprecate-to-forgejomirror pattern (forgejo canonical, github passive mirror). For canonical READMEs to be useful on the forgejo side, embeds that work on github MUST work on forgejo too. Otherwise a visitor landing at the canonical home gets a degraded experience compared to the mirror, which inverts the intended hierarchy.vimdoc-language-serveris the prototype affected today — its README opens with a demo video. Any other repo that uses this idiom (and several upstreambarrettruth/*repos do) will hit the same gap.Root cause hypothesis
Github's renderer special-cases the
https://github.com/user-attachments/assets/<uuid>URL pattern: it detects the redirect Content-Type fromobjects.githubusercontent.com(video/mp4,image/png, etc.) and emits<video>/<img>accordingly. Forgejo's markdown renderer doesn't have this special case — bare URLs become anchor tags.Three possible fix paths to investigate:
pkgs/forgejo-cm6-langs/(or a sibling pkgs override) — same pattern we used for the cm6 syntax recoloring. Patch the renderer to detect^https?://github.com/user-attachments/assets/.+$bare URLs on their own paragraph and emit<video src="..." controls autoplay loop muted playsinline>. Or use a sniff probe: HEAD the URL, follow the redirect toobjects.githubusercontent.com, read Content-Type, choose tag accordingly.custom/templates/overrides. We could add a tiny client-side script that finds<a>whosehrefmatches the user-attachments pattern and replaces with<video>. Less invasive than patching forgejo source but client-side only (won't help raw markdown view, RSS, etc.).Option 2 is the most consistent with the existing pkgs override pattern (
pkgs/forgejo-cm6-langs/) but needs research into where in forgejo's source the bare-URL-to-anchor transformation happens. Likelymodules/markup/markdown/...ormodules/markup/sanitizer.go.Auto-play behavior (sub-question)
Github's emitted
<video>element hasautoplay loop muted playsinlineattributes. Whether the forgejo override should match (auto-play) or differ (require click-to-play) is a separate decision. Default to matching github (auto-play, muted, loop) for visual parity unless a strong reason emerges to differ.Acceptance criteria
https://git.barrettruth.com/barrettruth/vimdoc-language-servershows the demo video inline, not a hyperlink.barrettruth/*repo with ahttps://github.com/user-attachments/assets/<uuid>URL on its own paragraph renders as a video.<img>— same special-case logic, different content-type branch.Out of scope