jgm/djot.lua

Use `"\\%0"` as replacement string to escape chars in Lua rather than function

Opened this issue · 1 comments

bpj commented

return (s:gsub("[][\\`{}_*<>~^'\"]", function(s) return "\\" .. s end))

It is probably more efficient to use "\\%0" as the replacement rather than a function. In a replacement string %0 gets replaced with the whole match, %1 with the first capture group and so on up to %9.

jgm commented

True. Feel free to submit a PR.