Proposal for a visual debug mode
Description
This likely borders on something that could be achieved with a package, but integrating it into the compiler might also make sense, depending on the scope. So I'm proposing the idea here.
When setting layouts, it is often difficult to determine where a particular (possibly unwanted) spacing comes from or what the dimensions/indents etc. of a single element are. Of course, you can use fills and strokes to some degree, but this is often burdensome or doesn't show the whole picture in an easy-to-overview manner.
Similar to the inspector in HTML/CSS environments or tools like geometry/showframe or lua-visual-debug in the LaTeX universe, a debug mode would be very useful.
This mode could show, for example:
- Outlines of blocks and page parts without affecting the layout
- Dimensions and x/y position of blocks and boxes without affecting content or layout
- Spacings and paddings for each element
- Whitespace, line and page breaks
- Baselines and lines per element
- Broken characters
Use Case
This approach would make debugging more intuitive, significantly reducing support requests and enhancing ease of use.
Rudimentary examples (not showing many possible features mentioned above):
Image Source: https://tex.stackexchange.com/questions/2083/how-can-i-visualize-boxes
I agree that something like this would be nice, though I'm leaning towards integrating it into tooling (web app / editor extensions) rather than the compiler. It's just much nicer to expose something like this in an interactive way.
It would be great if existing libraries could take advantage of this. For example fletcher also defines the debug: number argument for its diagram function. Some way to expose the if debug mode is enabled and which level (if this is to be considered) would allow for nice integrations!