pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

Optionally preserve whitespace in Lua stringify function

Open jeffvalk opened this issue 7 months ago • 0 comments

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).

jeffvalk avatar Jul 21 '24 15:07 jeffvalk