diff --git a/lib/std.lua b/lib/std.lua
index 64fc5d5..8418d60 100644
--- a/lib/std.lua
+++ b/lib/std.lua
@@ -127,4 +127,57 @@ M.file = function(text, url)
end
end
+M.note = function(text)
+ text = text or ""
+ if isHttp() then
+ return "
" .. esc(text) .. "
"
+ elseif isGemini() then
+ local width = 31
+
+ local function wrap_line(line)
+ local out = {}
+ local i = 1
+ local len = #line
+
+ if len == 0 then
+ out[#out + 1] = ""
+ return out
+ end
+
+ while i <= len do
+ out[#out + 1] = line:sub(i, i + width - 1)
+ i = i + width
+ end
+
+ return out
+ end
+
+ local lines = {}
+
+ for line in (text .. "\n"):gmatch("(.-)\n") do
+ local wrapped = wrap_line(line)
+ for _, w in ipairs(wrapped) do
+ lines[#lines + 1] = w
+ end
+ end
+
+ local border = "+" .. string.rep("=", width + 2) .. "+"
+ local empty = "|" .. string.rep(" ", width + 2) .. "|"
+
+ local out = {}
+ out[#out + 1] = border
+ out[#out + 1] = empty
+
+ for _, line in ipairs(lines) do
+ local padding = width - #line
+ out[#out + 1] = "| " .. line .. string.rep(" ", padding) .. " |"
+ end
+
+ out[#out + 1] = empty
+ out[#out + 1] = border
+
+ return table.concat(out, "\n")
+ end
+end
+
return M
diff --git a/test/default_gmi/www/index.lua b/test/default_gmi/www/index.lua
index 8d65a16..f1fe9b1 100644
--- a/test/default_gmi/www/index.lua
+++ b/test/default_gmi/www/index.lua
@@ -5,4 +5,6 @@ local site = fes.fes("gemini")
site:h(1, "Hello, World!")
+site:note("Hello, World!. djsaklllllll\nlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll")
+
return site