RunestoneInteractive / rs

A New Monorepo structure for Runestone
Other
40 stars 66 forks source link

Whitespace in "blank" lines in sanitize-spaces changes indentation #499

Closed ascholerChemeketa closed 2 months ago

ascholerChemeketa commented 2 months ago

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.

bnmnetp commented 2 months ago

Should this be moved to PreTeXt ?

ascholerChemeketa commented 2 months ago

Yes, yes it should.