label-screenshot
Adds a caption band to an already-captured screenshot.
A store listing shows screenshots ONE AT A TIME, in a carousel, with no caption of its own — so an image has to say what it is showing. Without that, a shot of the state a plugin removes reads as a shot of the state the plugin causes, which is the opposite of the message.
The band is drawn over the BOTTOM of the frame, for two reasons: the top is where the content being demonstrated usually starts, and the bottom of an Obsidian frame is chrome — status bar, word count, sync indicator — which the band then covers rather than competing with.
This is post-processing, deliberately. The capture stays an untouched device frame, and rewording a label needs no re-shoot.
A caption that is too long for its frame is MEASURED and rejected rather than drawn. An SVG <text> is clipped by its viewport at both ends with no ellipsis and no error, so an overlong caption ships as a sentence fragment that looks deliberate — nabled in Settings - a listening plugin is told — and the frame is still exactly the size it should be, so every dimension assertion downstream still passes. The only feedback anyone ever got was looking at the PNG. See measureLabelCaption.
Interfaces
Section titled “Interfaces”| Interface | Description |
|---|---|
| ComputeLabelBandParams | Parameters for computeLabelBand. |
| LabelBandGeometry | The geometry of the caption band. |
| LabelCaptionMeasurement | What a caption measures against the frame it is destined for. |
| LabelScreenshotOptions | Options for labelScreenshot. |
| MeasureLabelCaptionParams | Parameters for measureLabelCaption. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
| buildLabelSvg | Builds the SVG for the caption band. |
| computeLabelBand | Computes the caption band’s size and position for a given image. |
| escapeSvgText | Escapes text for inclusion in SVG character data. A caption is authored per screenshot and can legitimately contain & or the angle brackets Obsidian uses in link syntax; unescaped, those make the SVG impossible to parse and sharp fails on a caption rather than on an image. |
| labelScreenshot | Draws a caption band across the bottom of a screenshot. The image keeps its dimensions exactly: the band is composited OVER the frame, never appended to it, because the store expects a specific size. |
| measureLabelCaption | Measures a caption against the frame it is destined for, without drawing anything. This is what labelScreenshot rejects an overlong caption with, exposed so a caption can be chosen with the number in hand instead of by capturing a frame and looking at it. |