Render static HTML files natively in the repository view (HTML as a first-class markup format) #197069
Replies: 1 comment
-
|
Thank you for your interest in contributing to our community! We currently only accept discussions created through the GitHub UI using our provided discussion templates. Please re-submit your discussion by navigating to the appropriate category and using the template provided. This discussion has been closed because it was not submitted through the expected format. If you believe this was a mistake, please reach out to the maintainers. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello GitHub team,
I'd like to propose native rendering of static HTML files directly in the repository view, the same way Markdown is rendered today.
The friction. GitHub already gives
.mdfiles a great reading experience, but.htmlfiles are still shown as raw source. Anyone who keeps static reports, documentation, demos, or generated artifacts as HTML has to leave GitHub — spin up GitHub Pages, download the file, or route through third-party proxies likeraw.githack.com— just to see what the file renders to. For a format the browser was built to display, that round trip feels backwards.Why this matters more now. Markup formats have evolved with how we read: raw text → Markdown → HTML. In the AI-agent era this curve is accelerating, because HTML is readable by both humans and machines and lifts the ceiling Markdown puts on density and structure. This isn't a fringe view:
.htmlartifacts instead of walls of Markdown — trading "a document you'd skim for one you'd actually read."As more tools and agents emit complete HTML outputs — reports, evaluation dashboards, styled docs, notebooks exported to HTML — HTML is becoming a primary artifact format, not an edge case. Rendering it natively would make these outputs reviewable where the code already lives.
You already do this for other formats. GitHub natively renders Jupyter notebooks, PDFs, CSV/TSV, GeoJSON/TopoJSON maps, STL 3D models, and sanitized SVG. SVG is a direct precedent: it's markup GitHub renders after stripping unsafe content. Static HTML is the conspicuous gap.
I understand the security history. I know why GitHub serves raw files as
text/plain(+nosniff) and isolates executable user content on a separate origin (*.github.io): the 2013 Pages domain migration and the raw-serving policy both exist to keep user-controlled HTML/JS off thegithub.comorigin where session cookies live. This proposal is deliberately compatible with that history — it asks for static, sanitized rendering, never execution.What I'm actually asking for. I'm not claiming "HTML without JavaScript is inherently safe" — script-free HTML/CSS still carries real vectors (CSS-based exfiltration,
<form>phishing,<meta refresh>redirects, external-resource beacons, inline SVG). The ask is narrower and mirrors what GitHub already does for Markdown: render static.htmlthrough the same sanitize-and-isolate pipeline:<script>, event handlers,<meta refresh>, dangerous tags) — the same machinery already applied to inline HTML in Markdown and to SVG;sandboxiframe (no scripts, no form submission, no top-level navigation, no same-origin);github.com.Optionally, gate it behind an explicit "Preview HTML" button instead of auto-rendering. This makes a static HTML file exactly as safe as the inline HTML GitHub renders in Markdown today.
Related, existing demand. This builds on requests the community has already raised:
.htmlfile at the file-view level, not just READMEs.A repository-level sandboxed preview addresses the underlying need more directly than either alone.
Thanks for considering this.
Beta Was this translation helpful? Give feedback.
All reactions