Skip to content

feat(autolink): render <URL> inline and embed user-attachments media#13

Merged
delphinus merged 1 commit into
mainfrom
feat/autolink-user-attachments
May 15, 2026
Merged

feat(autolink): render <URL> inline and embed user-attachments media#13
delphinus merged 1 commit into
mainfrom
feat/autolink-user-attachments

Conversation

@delphinus
Copy link
Copy Markdown
Owner

Summary

  • Inline CommonMark autolink (<https://example.com>) now strips the angle brackets in the rendered output and registers the URL as a clickable link (previously the brackets leaked through as literals).
  • A standalone <URL> line pointing at GitHub's user-attachments CDN is routed through the image pipeline so it inlines as video/image — same behavior as github.com. Existing download_async + magic-byte detection + ffprobe handles the actual rendering. Restricted to that CDN to avoid stuck "Loading..." placeholders for non-media URLs.

Test plan

  • make test (515 passed, 0 failed; +5 new autolink tests in tests/link_types_test.lua)
  • Loaded ~/.local/share/nvim/lazy/undo-glow.nvim/README.md (which has 19 <https://github.com/user-attachments/assets/...> lines): all 19 register as image_placements with src_url populated
  • Manual: open the same README with :MdRender in a Kitty-graphics-capable terminal and confirm the videos play

🤖 Generated with Claude Code

CommonMark autolink (`<https://example.com>`) was leaving literal `<` and
`>` in the rendered output because process_bare_urls excluded them from
its URL regex. Inline autolinks now strip the brackets and register the
URL as a clickable link, with the same long-URL truncation as bare URLs.

Standalone `<URL>` lines pointing at GitHub's user-attachments CDN
(`https://github.com/user-attachments/...`) now route through the image
pipeline, mirroring github.com's behavior of inlining these as
`<video>`/`<img>` based on Content-Type. The existing download_async +
magic-byte detection + ffprobe path handles the actual media rendering.
Restricted to that CDN so non-media URLs do not get stuck on a
"Loading..." placeholder.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@delphinus delphinus merged commit 166457c into main May 15, 2026
0 of 4 checks passed
@delphinus delphinus deleted the feat/autolink-user-attachments branch May 15, 2026 06:20
delphinus added a commit that referenced this pull request May 15, 2026
image_placements are only registered when image.supports_kitty()
returns true, which requires a Kitty graphics-capable terminal
(WezTerm/kitty/ghostty). CI runners report false, so the standalone
autolink tests added in #13 failed there even though the routing
logic itself is correct.

Stub image.supports_kitty for the duration of these tests with a
restore-on-error wrapper. The negative test is also stubbed so it
exercises the URL filter rather than passing for the wrong reason
(no placement because no kitty support).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant