pandoc
pandoc copied to clipboard
Optionally preserve whitespace in Lua stringify function
The pandoc.utils.stringify
function normalizes all whitespace. It would be very useful to have the option to return whitespace as represented in the AST.
Addition of an optional preserve_whitespace
argument to the stringify
function could allow for this. And it could be fully backward compatible:
- If the argument is false or omitted, stringify would normalize all whitespace as it currently does
- If the argument is true, stringify would include all whitespace literally (including multiple consecutive line breaks or spaces)
This would allow for other values of preserve_whitespace
to be added later if desired (for example, including line breaks but merging consecutive line breaks together). A value of true would mean "preserve whitespace maximally"; false would be the minimal version; and anything in between (if desired) could be named (i.e., a string value).