Add support for minification or prettification of Leaf's final output
I'm finding that the default output of a readable Leaf template includes quite a lot of unnecessary whitespace. To combat this, I'm reducing the "real" whitespace in my Leaf templates, but it's making them unreadable.
It would be great if Leaf could be told to ignore whitespace in certain contexts, or better yet, if Leaf supported minification/prettification of it's output.
The Swift Stencil template language has a similar feature when setting trimBehavior to .smart or .all.
let environment = Stencil.Environment(
loader: FileSystemLoader(paths: [Path(templatesPath)]),
extensions: [ext],
trimBehaviour: .smart
)
I would prefer this technique so Leaf can render formats like Markdown or Asciidoc more cleanly. I'm rendering these formats with Leaf and it works great for the most part, but it would be nice to trim the extra whitespace around block declarations.