Debug
Debug System
Development
The layout debug layer: add .stnd-debug to <html> (the Workshop, the Astro dev toolbar and ::debug do) and the page shows its structure. The layer is made of independent guides; every one is on by default and is muted by naming it in data-debug-off on the same element (<html class="stnd-debug" data-debug-off="type margins">). Hidden in print.
The guides that need a measurement a stylesheet cannot make (does this block sit on the baseline grid? does it overflow? how long is the line?) are drawn by @stnd/workshop/debug into .stnd-debug-audit; their look is here, with the others.
| Guide | Shows | |————|——-| | baseline | The baseline grid over the whole document (one root line). | | rhythm | The gap of every .rhythm block, tagged with its element. | | columns | The columns of every .grid-N, the gutters tinted, each child outlined. | | type | Baseline, x-height and cap-height of the text in .prose and .rhythm. | | margins | The page padding on both sides. | | snap | (script) Blocks whose baseline (trimmed text) or top edge is off the baseline grid, with the offset. | | offgrid | (script) Grid children that do not start and end on a column edge. | | overflow | (script) Elements wider than the window, the usual cause of a sideways scroll. | | measure | (script) Characters per line of the prose, green from 45 to 75. | | runts | (script) A last line that holds a single word. | | tokens | (script) Hover a block: its margin, padding, gap and type, as tokens. |
| Name | Description | Value |
|---|---|---|
.stnd-debug |
Enable the debug layer (on <html> for the whole page; on a container for its grids and rhythm). |
|
data-debug-off? |
Space-separated guides to mute. | |
.debug |
Content that exists only while the debug layer is on. | |
--debug-color |
Colour of the grid and rhythm guides (default cyan). | var(--color-cyan) |
--debug-opacity |
Opacity of the guides. | 50% |
--stnd-workshop-bg |
Debug HUD background. | color-mix( in srgb, var(--color-dark-background) 90%, var(--color-dark-foregroun… |
--stnd-workshop-text |
Debug HUD text. | color-mix( in srgb, var(--color-dark-background) 10%, var(--color-dark-foregroun… |
// Enable the debug layer on the page, without the type lines
<html class="stnd-debug" data-debug-off="type">
// Debug one grid
<div class="grid-12 stnd-debug">
<div class="col-4">Shows the column overlay</div>
</div>
since 0.1.0
All classes
Standard debug system
| Class | Declares |
|---|---|
.debug |
display: none |
.stnd-debug .debug |
display: inherit |
.stnd-debug-audit |
position: absolute |
.stnd-debug body::after |
content: "md · 769–1023px" |
.stnd-debug body::after |
content: "xs · <600px" |