Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-LAYOUT-002

The text column width follows the maxContentWidth setting

When a preview page is built or the setting markdownOkfSchemaStudio.preview.maxContentWidth changes, the extension SHALL normalise the setting to a whole number of pixels from 0 to 2400 (960 when it is negative or not a finite number), write it into the page style as the width rule, and show a text column exactly that wide and centred in a wider pane, with no cap when the value is 0.

Step 1 of path 2 in StRS-MDOKFSTUDIO-LAYOUT-003: from “The setting maxContentWidth is changed” to “The text column is as wide as the setting says”.

Scenarios 8

The situations the tests check; open one to read it.

nominalDefault cap in a wide pane
Giventhe setting maxContentWidth at its default 960, Margin width mode, 100 percent zoom and a 1600 px pane
Whenthe preview is rendered
Thenthe content column is 960 px wide and the free space is split equally left and right
nominalConfigured cap above the default
GivenmaxContentWidth set to 1400 and a 2000 px pane (visual scenario v85)
Whenthe preview is rendered
Thenthe content column is exactly 1400 px wide and centred; in a pane narrower than the cap the column takes the pane width instead
boundaryNormalisation of the setting
InputOutcome
25002400
1049.61050
2400stays 2400
0stays 0 (0 is not cut or replaced)
-1960, the default
the text wide960, the default
NaN960, the default
boundaryZero lifts the limit
GivenmaxContentWidth set to 0 and a 2000 px pane
Whenthe width rule is built and the preview is rendered
Thenthe rule reads :root { --sphinx-preview-content-max-width: none; } and the column is not limited to a pixel width
with maxContentWidth set to 1 the rule reads --sphinx-preview-content-max-width: 1px, because only 0 lifts the limit
nominalConfigured width in the page style
GivenmaxContentWidth set to 1200
Whenthe page HTML is built
Thenthe page style ends with :root { --sphinx-preview-content-max-width: 1200px; }
refusalInvalid configured width in the page style
GivenmaxContentWidth set to a negative number
Whenthe page HTML is built
Thenthe page style carries 960px, the default
nominalOpen preview follows a change of the setting
Givenan open preview that has a last good render and maxContentWidth changed from 960 to 1200
Whenthe settings change event arrives
Thenthe session re-reads the preview configuration, schedules the incoming-changes refresh, and updates the preview from the last good render; the page shell now carries the new width rule, so the whole page is replaced (no in-place content patch)
refusalNo last good render or unrelated section
Givenan open preview that has no last good render yet, or a settings change outside the preview, PlantUML and frontmatter sections
Whenthe settings change event arrives
Thenthe preview is not updated (no change for an unrelated section; nothing to redraw without a last good render)

Implemented in 5

Tested by 7

Known limits (6)

Replaces

SwRS-MDOKFSTUDIO-LAYOUT-003The maximum content width is rounded and capped at 2400 superseded superseded by SwRS-MDOKFSTUDIO-LAYOUT-002 Markdown file
SwRS-MDOKFSTUDIO-LAYOUT-004A width of zero lifts the column limit superseded superseded by SwRS-MDOKFSTUDIO-LAYOUT-002 Markdown file
SwRS-MDOKFSTUDIO-LAYOUT-005Each rendered page carries the width rule superseded superseded by SwRS-MDOKFSTUDIO-LAYOUT-002 Markdown file
SwRS-MDOKFSTUDIO-LAYOUT-006Open previews follow a change of the width setting superseded superseded by SwRS-MDOKFSTUDIO-LAYOUT-002 Markdown file
SwRS-MDOKFSTUDIO-LAYOUT-036A negative or non-numeric width falls back to 960 superseded superseded by SwRS-MDOKFSTUDIO-LAYOUT-002 Markdown file