stagit

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

commit 2514eadcd76c7664bdb1151c6b9b7e0348fca585
parent 86c891b57ba1fe3b5753b37abd6e1bb17fc92a3d
Author: awy <awy@awy.one>
Date:   Tue, 16 Dec 2025 12:00:44 +0300

inline img

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

diff --git a/stagit.c b/stagit.c @@ -976,7 +976,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);