Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-018

The sticky band shows the current heading path

When a heading of level h1 to h6 of the running text lies at or above the reading line, the extension SHALL show in the sticky band that heading and its nearest parent headings, one line each, up to the depth setting (markdownOkfSchemaStudio.preview.stickyHeadingDepth, rounded, kept between 1 and 6 and 3 when it is not a number; a change of the setting while a preview is open loads the full page again with the new depth rather than patching the content in place), each line written with its # markers and without comment chips, and hide the band and empty its text when no heading lies at or above the reading line.

Step 1 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-004: from “The reader scrolls the document” to “The band shows the current heading path”.

Scenarios 11

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

nominalDepth 3
Givena document with h1, h2 and h3 headings, depth 3 and the reading line inside the h3 section
Whenthe page updates the band
Thenthe band holds three lines such as # Title, ## Section and ### Part
boundarySkipped level
Givenan h1 followed directly by an h3 and depth 3
Whenthe page updates the band
Thenthe band holds two lines, the h1 and the h3, because a parent must be a shallower level than the line below it
boundaryAbove the first heading
Givena document whose first heading is below the reading line
Whenthe page is scrolled to the top
the same document is scrolled past the first heading and the page updates the band
Thenthe band is hidden and has no text
the band shows
nominalEvery heading level
Givenan h5 heading in a normal section
Whenthe reading line passes it
Thenthe band shows the h5 heading with five # markers
boundaryZero-height heading
Givena heading with zero height between an h1 and an h3
Whenthe page measures headings
Thenit is never the current heading and never a parent line, so the band holds the h1 and the h3 only
boundaryHeadings the table of contents leaves out
Givenan h2 inside an admonition and an h4 inside the properties table, between an h1 and an h3
Whenthe reading line passes them
Thenneither is the current heading nor a parent line, so the band follows the headings of the running text only
nominalComment chips
HeadingBand line
text followed by a comment chipthe heading words only, without the chip and its hidden body
plain headingthe heading text unchanged
boundaryOut of range and not a number
ValueDepth
01
4.65
126
NaN or a string3, the default of the setting
nominalPage uses the configured depth
DepthHeadingBand
1a heading with two parentsonly the current heading
6a heading with five parentssix lines
nominalSetting changed
Givenan open preview and a new stickyHeadingDepth
Whenthe next render is sent
Thenthe context key differs, so no content patch is planned and the whole page is assigned with the new depth
boundarySetting unchanged
Givenan open preview and an unrelated edit
Whenthe next render is sent
Thenthe context key is equal and the content may be patched

Implemented in 4

Tested by 8

Replaces

SwRS-MDOKFSTUDIO-TOOLBAR-022The sticky heading depth setting decides how many levels stay pinned superseded superseded by SwRS-MDOKFSTUDIO-TOOLBAR-018 Markdown file