Open reschke opened 3 years ago
Good point. We follow the HTML model outside of artwork, sourcecode. Do we preserve space anywhere else?
Do we preserve space anywhere else?
Nope.
@reschke What's the best way to cite the whitespace handling model from the HTML spec?
Good question. It's possible that the HTML5 parsing algorith contains some info, but that's nothing I would refer to in order to explain things.
Turns out that the actual answer is CSS. See https://patrickbrosset.medium.com/when-does-white-space-matter-in-html-b90e8a7cdd33 for an intro which cites https://www.w3.org/TR/css-text-3/#white-space-property. The rules relevant for us would be "normal" (essentially all elements but \
AIUI, currently in almost all contexts (mostly except artwork and sourcecode) we strip leading and trailing whitespace enclosed in an XML element, which matches Julian's note about "normal" and "pre" in the CSS spec. This will be documented more accurately.
We currently say that \ and \ preserve whitespace, but are vague abut what exactly applies to other elements.
My understanding is:
(note that this happens to be same model as in HTML)
We may also want to state in the preptool spec what that means for pretty printing (there are both reasons to do that normalization and not to do it).