summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-11-28 11:44:39 +0000
committerubq323 <ubq323@ubq323.website>2024-11-28 11:44:42 +0000
commitc7d9efdb19b650733f19176e11389e865ee92272 (patch)
tree5b2b4c90dee59059c23baad9ff89b24c63328231 /init.lua
parent16e9f4ef0ab0ad51a7a05fd98ee1870c81b20a73 (diff)
use lua-run for shelling out to highlightHEADtrunk
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua15
1 files changed, 5 insertions, 10 deletions
diff --git a/init.lua b/init.lua
index 801f9d2..6f09cb8 100644
--- a/init.lua
+++ b/init.lua
@@ -3,16 +3,11 @@ local T = html.T
local prose = require'garkup.prose'
local function highlight(code, lang)
- -- you'd better not already be using that file
- local infile = assert(io.open("/tmp/highlighter_input","w"))
- assert(infile:write(code))
- local outhandle = assert(io.popen("highlight -f -S "..lang.." --inline-css --enclose-pre </tmp/highlighter_input", "r"))
- local output = assert(outhandle:read"a")
-
- outhandle:close()
- infile:close()
-
- return html.safe(output)
+ local run = require'run'
+ return html.safe(run{
+ "highlight", "-f", "-S", lang, "--inline-css", "--enclose-pre",
+ input = code,
+ })
end
local function mode_code(S)