Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-PALETTE-127

Admonition wraps lines in a colon fence of a chosen type

When the writer presses Admonition and chooses a type from the menu of Note, Tip, Important, Warning, Caution, Danger, Attention, Error, Hint, See also and Custom…, the extension SHALL wrap the touched lines in a colon fence `:::{type}`, or with no selection insert an empty fence set apart by blank lines with the caret on the empty body line, and make no edit for a missing or unknown type.

Step 1 of path 1 in StRS-MDOKFSTUDIO-PALETTE-021: from “The palette is shown above the text box in the MyST mode” to “The lines are wrapped in a fence”.

Scenarios 7

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

nominalThe menu of eleven types
Giventhe MyST mode
Whenthe writer presses Admonition
Thenthe menu lists the eleven entries Note, Tip, Important, Warning, Caution, Danger, Attention, Error, Hint, See also and Custom… in this order, with the option values note, tip, important, warning, caution, danger, attention, error, hint, seealso and custom
boundaryOther modes
Giventhe strict or GFM mode
Whenthe buttons are listed
Thenthere is no Admonition button
nominalA chosen type wraps the touched lines
GivenChosenOutcome
The lines one, two and three with the first two selectedwarningThe first two lines are inside `:::{warning}` and `:::`, the body is selected and three is outside
A selection from the start of one to the start of twonoteOnly the first line is wrapped
No selectiona typeAn empty fence set apart by blank lines is inserted, with the caret on the empty body line
A selection with list item linesa typeThe list item lines stay together inside the fence
nominalThe fence has one colon more than the longest fence inside
SelectionChosenOuter fence
A fence of three colonshintFour colons
A fence of four colonshintFive colons
No colon fence insideany typeThree colons (at least three)

Only lines that start with three or more colons count as fences.

refusalUnknown or missing type
ArgumentOutcome
bogusNo edit is produced
No argumentNo edit is produced

Only the ten types and custom are accepted.

nominalCustom writes a titled admonition with a class
Giventhe selected text Body
the caret after Intro
WhenCustom is chosen
Custom is chosen
Thenthe text is `:::{admonition} Title` with the option `:class: note` and Body, and Title is selected
a new titled fence follows Intro, set apart by a blank line, with Title selected
InputOutcome
Custom chosenThe option line `:class: note` is followed by a blank line
nominalDropdown writes a note admonition with the dropdown class
Giventhe caret after intro
a selection that is a tip fence of three colons
WhenDropdown is pressed
Dropdown is pressed
Thena note admonition with the title Title and the option `:class: dropdown` and the content Content follows intro after a blank line, with Title selected; with a selection the touched lines are wrapped instead of the sample
the outer fence has four colons, as in the scenario of the colon count

Implemented in 2

Tested by 1

Replaces

SwRS-MDOKFSTUDIO-PALETTE-130Custom writes a titled admonition with a class superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-127 Markdown file
SwRS-MDOKFSTUDIO-PALETTE-137Dropdown writes a note admonition with the dropdown class superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-127 Markdown file