summaryrefslogtreecommitdiffstats
path: root/lua/inbox/renderers/w3m.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/inbox/renderers/w3m.lua')
-rw-r--r--lua/inbox/renderers/w3m.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/lua/inbox/renderers/w3m.lua b/lua/inbox/renderers/w3m.lua
new file mode 100644
index 0000000..bd7e33b
--- /dev/null
+++ b/lua/inbox/renderers/w3m.lua
@@ -0,0 +1,29 @@
+---@type inbox.Renderer
+local M = {}
+
+function M.render(bufnr)
+ local entry = vim.b[bufnr].inbox.entry
+ local content_type = vim.b[bufnr].inbox.content_type
+ vim.api.nvim_buf_call(bufnr, function()
+ local job_id = vim.fn.termopen({
+ "socksify",
+ "w3m",
+ "-I",
+ "UTF-8",
+ "-T",
+ "text/html",
+ "-cols",
+ tostring(vim.bo[bufnr].textwidth),
+ "-dump",
+ "-o",
+ "display_image=false",
+ "-o",
+ "display_link_number=true",
+ })
+
+ local part = entry.parts[content_type]
+ vim.fn.chansend(job_id, part.content)
+ end)
+end
+
+return M