Create a Lua filter API, like pandoc's Lua filters API.
Doing this might require changing the way we currently represent the AST in Lua. The current method is designed for speed, but uses some conventions that make it fragile for direct interaction (e.g., annotation as first component of an array). (Perhaps we could use metatables to provide a friendly public interface to the current array-based structure.)
Alternatively, we could leave the AST as it is but provide special functions for manipulating it.
Create a Lua filter API, like pandoc's Lua filters API.
Doing this might require changing the way we currently represent the AST in Lua. The current method is designed for speed, but uses some conventions that make it fragile for direct interaction (e.g., annotation as first component of an array). (Perhaps we could use metatables to provide a friendly public interface to the current array-based structure.)
Alternatively, we could leave the AST as it is but provide special functions for manipulating it.