Closed Witiko closed 6 years ago
Why not create a custom lua writer?
See the example here:
See also #1541.
I suppose that with a custom Lua writer, there would be no need to touch the code base of Pandoc at all. As an added advantage, all Pandoc versions beyond 2.0 would be automatically supported, whereas with a Haskell writer, there would be some lag before everyone has a current enough version.
I appologize for opening a duplicate thread. I will close this issue and move future discussion to #1541.
This is a pitch for a new feature for Pandoc that I would be happy to implement. Before I do, however, I would like to hear your thoughts.
I am the author and maintainer of witiko/markdown – a TeX package that uses a fork of the jgm/lunamark Markdown parser to provide Markdown support directly in TeX. The package takes a Markdown document:
and converts it to an abstract syntax tree (AST) in the form of TeX macros:
The user can easily redefine these TeX macros to control the design of their document. They can even abuse the Markdown syntax in creative ways. The other major advantage is that the package has no external dependencies, since a Lua interpreter is included in TeX distributions. Therefore, the package works even in constrained environments, such as the online LaTeX editor of Overleaf (see a related article).
The disadvantage is that by having no external dependencies, the package misses out on the opportunity to integrate with tools such as Pandoc that would allow a much wider range of Markdown flavors and other input formats. Therefore, I am planning to add support for backends other than the internal Lua parser. As a prerequisite, I would need to add a Pandoc writer that produces the above TeX AST syntax. Note that this is useful even outside the context of my TeX package, which at this point will only provide some sensible default definitions for the TeX AST macros and execute Pandoc in the background.