Add info on how to debug Lua filters (#6732)

Add info on debugging Lua filters.
This commit is contained in:
Ian Max Andolina 2020-10-08 17:56:08 +08:00 committed by GitHub
parent 1be0f0fba8
commit d1e1898c52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -305,6 +305,25 @@ end
This makes it possible to apply these functions on strings using
colon syntax (`mystring:uc_upper()`).
# Debugging Lua filters
It is possible to use a debugging interface to halt execution and step through a
Lua filter line by line as it is run inside Pandoc. This is accomplished using
the remote-debugging interface of the package
[`mobdebug`](https://github.com/pkulchenko/MobDebug). Although mobdebug can be
run from the terminal, it is more useful run within the donation-ware Lua editor
and IDE, [Zerobrane](https://studio.zerobrane.com/). Zerobrane offers a REPL
console and UI to step-through and view all variables and state.
If you already have Lua 5.3 installed, you can add
[`mobdebug`](https://luarocks.org/modules/paulclinger/mobdebug) and its
dependency [`luasocket`](https://luarocks.org/modules/luasocket/luasocket) using
[`luarocks`](https://luarocks.org), which should then be available on the path.
Zerobrane also includes both of these in its package, so if you don't want to
install Lua seperately, you should add/modify your `LUA_PATH` and `LUA_CPATH` to
include the correct locations; [see detailed instructions
here](https://studio.zerobrane.com/doc-remote-debugging).
# Examples
The following filters are presented as examples. A repository of