stagit

static git page generator
git clone https://git.awy.one/stagit
Log | Files | Refs | README | LICENSE

commit 9a1a424b3ae7af21968c2dce62b9d54562003b81
parent 0363fd899264c9187937d60ac1c3a128af121a4d
Author: awy <awy@awy.one>
Date:   Fri, 10 Apr 2026 21:30:44 +0300

feat: inline images

Diffstat:
Mstagit.c | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/stagit.c b/stagit.c @@ -979,7 +979,19 @@ writeblob(git_object *obj, const char *fpath, const char *filename, size_t files fputs("</p><hr/>", fp); if (git_blob_is_binary((git_blob *)obj)) - fputs("<p>Binary file.</p>\n", fp); + { + char* fext = strrchr(filename, '.'); + if (fext && (!strcmp(fext, ".png") || + !strcmp(fext, ".jpg") || + !strcmp(fext, ".jpeg") || + !strcmp(fext, ".svg") || + !strcmp(fext, ".webp") || + !strcmp(fext, ".avif"))) + fprintf(fp, "<a href=\"/%s/plain/%s\"><img id=\"blob-img\" src=\"/%s/plain/%s\" /></a>\n", + name, entrypath, name, entrypath); + else + fputs("<p>Binary file.</p>\n", fp); + } else lc = writeblobhtml(fp, (git_blob *)obj, filename);