Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-MYST-036

Labels show an anchor icon on the next block

When a document holds a `(name)=` label, the extension SHALL show a faint anchor icon with the tooltip Anchor: name as the first child of the next paragraph or heading without moving the text, make it a link target without duplicating an existing id, and keep the icon out of the mapped blocks and the Tab order with the absolute source line of its label.

Step 1 of path 1 in StRS-MDOKFSTUDIO-MYST-009: from “A document holds a `(name)=` label” to “The label shows an anchor icon”.

Scenarios 4

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

nominalThe icon sits on the next paragraph or heading
Given`(intro)=` before a paragraph or heading
Whenthe preview renders
Thenthe icon sits in the left margin, the text does not move and the id is the label unless the heading or figure already carries it
boundaryA label before another block or at the end
Givena label before a list, table, figure, code block or at document end
Whenthe preview renders
Thenthe icon sits alone in a zero-height row
InputOutcome
Label characters: letters, digits and `_ . : -`accepted in a label name
Consecutive labelseach gets an icon
nominalThe icon is not a mapped block and carries its source line
Givena document with frontmatter and a label
Whenthe preview renders
Thenthe icon has no data-line, data-sphinx-preview-block or tabindex, data-okf-label-line counts the frontmatter lines, and the icon has role img and aria-label Anchor: name
boundaryThe labelled block keeps its own mapping
Giventhe labelled paragraph or heading
Whenthe preview renders
Thenit keeps its own mapping

Implemented in 1

Tested by 2

Replaces

SwRS-MDOKFSTUDIO-MYST-037The anchor icon is not a mapped block and carries its source line superseded superseded by SwRS-MDOKFSTUDIO-MYST-036 Markdown file