Show a Hugging Face repository's model card on the mirror page

Opening a repository shows its model card, rendered from markdown, with
its base model, license and languages above it; the listing names each
repository's base model and license under its name. The card is a
stranger's text: raw HTML and dangerous links are dropped, images are
shown as links rather than loaded, and relative links point into the
repository.

Adds github.com/yuin/goldmark for the markdown.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-09-28 22:03:19 +02:00
1 parent 02fa639657
commit 3fea39feb9
10 files changed
+375 -27

No files matched your search

+12
View File
@@ -476,3 +476,15 @@ table.explore .cannot { color: var(--bad); }
.tag { display: inline-block; font-size: .7rem; font-weight: 600; color: var(--muted);
border: 1px solid var(--line); border-radius: 999px; padding: 0 .4rem; margin-left: .3rem; vertical-align: 1px; }
.tag.new { color: var(--accent); border-color: var(--accent); }
table.explore .from { font-size: .75rem; color: var(--muted); margin-top: .15rem; overflow-wrap: anywhere; }
.repo-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; color: var(--muted); margin: .25rem 0 .75rem; }
/* A README is written for its own site. Held to a box so the file list, which
is what this page is for, stays within reach below it. */
details.model-card { border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin: 0 0 1rem; }
details.model-card > summary { cursor: pointer; padding: .5rem .8rem; font-weight: 600; font-size: .9rem; }
details.model-card .card-body { max-height: 28rem; overflow: auto; padding: 0 1rem 1rem; font-size: .88rem; line-height: 1.55; }
.card-body h1 { font-size: 1.25rem; } .card-body h2 { font-size: 1.1rem; } .card-body h3, .card-body h4 { font-size: .95rem; }
.card-body pre { overflow-x: auto; padding: .6rem .75rem; background: var(--bg); border-radius: 6px; font-size: .8rem; }
.card-body table { width: auto; max-width: 100%; display: block; overflow-x: auto; font-size: .8rem; }
.card-body td, .card-body th { padding: .25rem .5rem; }
.card-body a.img { font-size: .8rem; }