Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-PALETTE-043

The Heading list sets the heading level of the touched lines

When the writer presses the Heading button, the extension SHALL open a menu named Heading with the entries Paragraph and Heading 1 to Heading 5, and apply the chosen level by putting the matching number of # signs and a space in front of every non-blank line that the selection touches, replacing another level, and removing the prefix for Paragraph.

Part of StRS-MDOKFSTUDIO-PALETTE-019, outside the paths drawn on its map.

Scenarios 5

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

nominalChoosing a level
Givena paragraph with the caret in it
Whenthe writer presses Heading and chooses Heading 2
Thenthe list closes and the line starts with ##
nominalMenu entries and tooltip
Giventhe palette
Whenthe writer hovers the Heading button and opens the menu
Thenthe tooltip reads Heading level and the menu items carry the option values 0 to 5 with the labels Paragraph, Heading 1 to Heading 5
nominalTwo lines
Giventhe selection a and b on two lines
Whenthe level 2 is applied
Thenboth lines start with ##
boundaryWhat counts as a heading line
Givena selection with the line of the table
Whena level from 0 to 5 is applied
Thenthe outcome is the one of the table
LineOutcome
another heading levelthe prefix is replaced by the chosen one
level 0 (Paragraph)the prefix is removed
seven # signsnot a heading, gets the prefix
a # followed by text without a spacenot a heading, gets the prefix
only one to six number signsa heading
a single blank linegets the prefix
other blank lines of a selectionleft alone
refusalNo change or unknown level
Givena line that already is a level 2 heading, or the level 9
Whenthe action runs
Thenno edit is produced

Implemented in 2

Tested by 2