diff --git a/pkgs/gemini/gmi2html/default.nix b/pkgs/gemini/gmi2html/default.nix
index bb16fbec70b0bd456271124a823c77dbecb1037f..26218927300eb344d432e92f59cd2b62cc331896 100644
--- a/pkgs/gemini/gmi2html/default.nix
+++ b/pkgs/gemini/gmi2html/default.nix
@@ -11,6 +11,11 @@     rev = "v${version}";
     hash = "sha256-B0+1s2eB1SAaVkGqj9OupMg0wGJGPj86NMEN765e7OU=";
   };
 
+  patches = [
+    # https://github.com/shtanton/gmi2html/pull/12
+    ./webp.patch
+  ];
+
   nativeBuildInputs = [ zig scdoc installShellFiles ];
 
   preConfigure = "HOME=$TMP";
@@ -18,6 +23,14 @@
   buildPhase = ''
     zig build -Drelease-safe
     scdoc < doc/gmi2html.scdoc > doc/gmi2html.1
+  '';
+
+  doCheck = true;
+
+  checkPhase = ''
+    substituteInPlace tests/test.sh \
+      --replace "zig-cache" "zig-out"
+    sh tests/test.sh
   '';
 
   installPhase = ''
diff --git a/pkgs/gemini/gmi2html/webp.patch b/pkgs/gemini/gmi2html/webp.patch
new file mode 100644
index 0000000000000000000000000000000000000000..827fdcb517e21c93a8edc2cc42dfc90ae417ac8c
--- /dev/null
+++ b/pkgs/gemini/gmi2html/webp.patch
@@ -0,0 +1,84 @@
+diff --git i/src/main.zig w/src/main.zig
+index 09e6abd..e5ed3a3 100644
+--- i/src/main.zig
++++ w/src/main.zig
+@@ -7,6 +7,7 @@ const imageExtensions = [_][]const u8{
+     ".jpeg",
+     ".jpg",
+     ".gif",
++    ".webp",
+ };
+ const videoExtensions = [_][]const u8{
+     ".mp4",
+diff --git i/tests/audio_target.html w/tests/audio_target.html
+index 17774b1..5434aa6 100644
+--- i/tests/audio_target.html
++++ w/tests/audio_target.html
+@@ -17,6 +17,7 @@
+ <p>=&gt gemini://example.org/testimg.png</p>
+ <a style="display: block;" href="https://example.org/video.mp4">test video</a>
+ <audio style="display: block;" controls src="https://example.org/audio.mp3"><a src="https://example.org/audio.mp3">test audio</a></audio>
++<a style="display: block;" href="http://example.org/testimg.webp">http://example.org/testimg.webp</a>
+ <p><br/></p>
+ <pre alt="Alt text">
+ some stuff
+diff --git i/tests/image_target.html w/tests/image_target.html
+index de4d450..3b5152e 100644
+--- i/tests/image_target.html
++++ w/tests/image_target.html
+@@ -17,6 +17,7 @@
+ <p>=&gt gemini://example.org/testimg.png</p>
+ <a style="display: block;" href="https://example.org/video.mp4">test video</a>
+ <a style="display: block;" href="https://example.org/audio.mp3">test audio</a>
++<a style="display: block;" href="http://example.org/testimg.webp"><img src="http://example.org/testimg.webp" alt="http://example.org/testimg.webp"/></a>
+ <p><br/></p>
+ <pre alt="Alt text">
+ some stuff
+diff --git i/tests/inlined_target.html w/tests/inlined_target.html
+index 210bf5c..cd92e08 100644
+--- i/tests/inlined_target.html
++++ w/tests/inlined_target.html
+@@ -17,6 +17,7 @@
+ <p>=&gt gemini://example.org/testimg.png</p>
+ <video style="display: block;" controls src="https://example.org/video.mp4"><a src="https://example.org/video.mp4">test video</a></video>
+ <audio style="display: block;" controls src="https://example.org/audio.mp3"><a src="https://example.org/audio.mp3">test audio</a></audio>
++<a style="display: block;" href="http://example.org/testimg.webp"><img src="http://example.org/testimg.webp" alt="http://example.org/testimg.webp"/></a>
+ <p><br/></p>
+ <pre alt="Alt text">
+ some stuff
+diff --git i/tests/source.gmi w/tests/source.gmi
+index 35af512..626cc39 100644
+--- i/tests/source.gmi
++++ w/tests/source.gmi
+@@ -17,6 +17,7 @@ I write things here
+ => gemini://example.org/testimg.png
+ => https://example.org/video.mp4 test video
+ => https://example.org/audio.mp3 test audio
++=> http://example.org/testimg.webp
+ 
+ ```  	Alt text
+ some stuff
+diff --git i/tests/target.html w/tests/target.html
+index ed3e00e..66fb19d 100644
+--- i/tests/target.html
++++ w/tests/target.html
+@@ -17,6 +17,7 @@
+ <p>=&gt gemini://example.org/testimg.png</p>
+ <a style="display: block;" href="https://example.org/video.mp4">test video</a>
+ <a style="display: block;" href="https://example.org/audio.mp3">test audio</a>
++<a style="display: block;" href="http://example.org/testimg.webp">http://example.org/testimg.webp</a>
+ <p><br/></p>
+ <pre alt="Alt text">
+ some stuff
+diff --git i/tests/video_target.html w/tests/video_target.html
+index eded463..f4047b2 100644
+--- i/tests/video_target.html
++++ w/tests/video_target.html
+@@ -17,6 +17,7 @@
+ <p>=&gt gemini://example.org/testimg.png</p>
+ <video style="display: block;" controls src="https://example.org/video.mp4"><a src="https://example.org/video.mp4">test video</a></video>
+ <a style="display: block;" href="https://example.org/audio.mp3">test audio</a>
++<a style="display: block;" href="http://example.org/testimg.webp">http://example.org/testimg.webp</a>
+ <p><br/></p>
+ <pre alt="Alt text">
+ some stuff
