commit f14d54431aa4cd1fb65aaecb6b10567f4485f758
Author: tri <tri@thac.loan>
Date:   Sun Sep 28 12:09:04 2025 +0700

    implement html escape util
    
    Not used yet though.

diff --git a/src/html.zig b/src/html.zig
new file mode 100644
index 0000000..50eafb5
--- /dev/null
+++ b/src/html.zig
@@ -0,0 +1,38 @@
+const std = @import("std");
+const t = std.testing;
+
+pub fn escape(
+    out: *std.Io.Writer,
+    text: []const u8,
+) !void {
+    for (text) |char| {
+        switch (char) {
+            '&' => try out.writeAll("&amp;"),
+            '"' => try out.writeAll("&quot;"),
+            '\'' => try out.writeAll("&#39;"),
+            '<' => try out.writeAll("&lt;"),
+            '>' => try out.writeAll("&gt;"),
+            else => try out.writeByte(char),
+        }
+    }
+}
+
+test "escape" {
+    var buf: [4096]u8 = undefined;
+    inline for (.{
+        .{
+            "<script>alert(\"jello\")</script>",
+            "&lt;script&gt;alert(&quot;jello&quot;)&lt;/script&gt;",
+        },
+        .{
+            "&\"'<>",
+            "&amp;&quot;&#39;&lt;&gt;",
+        },
+    }) |case| {
+        const input = case[0];
+        const expected = case[1];
+        var w = std.Io.Writer.fixed(&buf);
+        try escape(&w, input);
+        try t.expectEqualStrings(expected, w.buffered());
+    }
+}