summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)