Skip to content

Fix: Embed GitHub videos in docs site (remark plugin)#238

Merged
rstrahan merged 1 commit intodevelopfrom
fix/docs-render-video-viwer
Mar 12, 2026
Merged

Fix: Embed GitHub videos in docs site (remark plugin)#238
rstrahan merged 1 commit intodevelopfrom
fix/docs-render-video-viwer

Conversation

@rstrahan
Copy link
Copy Markdown
Contributor

Problem

GitHub video URLs (e.g. https://github.com/user-attachments/assets/<id>) render as inline video players on GitHub, but appear as plain text links on the Starlight docs site.

Before: https://aws-solutions-library-samples.github.io/accelerated-intelligent-document-processing-on-aws/demo-videos/ showed 21 video URLs as text links

After: All 21 videos render as embedded <video> players with play controls, matching GitHub's native behavior

Solution

Added a custom remark plugin (docs-site/plugins/remark-github-video.mjs, ~50 lines) that:

  1. Walks the markdown AST during Astro's build
  2. Finds paragraphs containing a single bare github.com/user-attachments/assets/ URL
  3. Replaces them with <video controls> HTML elements

Key properties:

  • No changes to any docs/*.md files — the markdown continues working on GitHub exactly as before
  • Automatic — any future GitHub video URLs in any doc will also be embedded
  • Zero new npm dependencies — uses remark's built-in AST visitor pattern

Files changed

File Change
docs-site/plugins/remark-github-video.mjs New — remark plugin
docs-site/astro.config.mjs Register the remark plugin
docs-site/src/styles/custom.css Video element styling
docs-site/package.json Pin zod@3 (fix Starlight build compat)

Verification

Built and deployed to GitHub Pages — 21 video tags confirmed in dist/demo-videos/index.html.

Converts bare GitHub user-attachments/assets URLs into inline <video> elements,
matching GitHub's native video embedding behavior. Also pins zod@3 to fix
Starlight build compatibility.
@rstrahan rstrahan merged commit 7951439 into develop Mar 12, 2026
2 checks passed
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