pretext icon indicating copy to clipboard operation
pretext copied to clipboard

Sanitize-text troubles with only whitespace on line

Open ascholerChemeketa opened this issue 7 months ago • 0 comments

If a block of text that is being sanitized has a line with only spaces, it can throw off the indentation stripping.

        this has 8 spaces of indentation
   
        this has 8 spaces - the preceding line has 4 spaces

The sanitize-text template will decide that block needs to have 4 spaces cleared. If the blank line has no spaces, it will get 8 spaces cleared.

In general, it would be better to strip out those blank spaces and not consider that line while calculating the left indent. But in some languages that might cause problems (markdown???).

Suggested fix is to make sanitize-text rip out spaces on otherwise blank lines. But, add a parameter to it that allows for preserving those spaces. Elements like <program> and <pre> would need an optional attribute to set that parameter.

ascholerChemeketa avatar Jul 09 '24 23:07 ascholerChemeketa