From d1e1898c5226d334f49fafb829f79508161108dc Mon Sep 17 00:00:00 2001 From: Ian Max Andolina Date: Thu, 8 Oct 2020 17:56:08 +0800 Subject: [PATCH] Add info on how to debug Lua filters (#6732) Add info on debugging Lua filters. --- doc/lua-filters.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 7cba5e3a9..8ce427a5d 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -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