mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.04k stars 49 forks source link

Option for pre-processor (feature request) #13

Closed scokobro closed 5 years ago

scokobro commented 5 years ago

Really looking forward to seeing PanWriter develop!

Not sure if it's a bit late in the day but the option to pass source text through a pre-processor such as pp or gpp (for preview?export?both?) would be great.

Many thanks!

mb21 commented 5 years ago

Thanks for the feedback!

You can already use pandoc filters, it's not exactly a pre-processor, but arguably something better: you can transform the document AST. See: http://pandoc.org/lua-filters.html, for example place the filter in the section "Replacing placeholders with their metadata value" in ~/.pandoc/filters/meta-vars.lua.

Then in PanWriter:

---
output:
  html:
    lua-filter: meta-vars.lua
---

my doc...
scokobro commented 5 years ago

Thanks for the speedy response. Understood re Lua filters, but, I would argue that the ridiculously useful macros that (for example) pp makes easily available shouldn't be overlooked (even though the documentation is hard work!) And they're useable without learning any Lua, or dealing with the Pandoc AST, which is a big advantage for casual hackers like me.