diff options
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -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) |