Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-PALETTE-277

Line-prefix buttons toggle their prefix on the touched lines

When the writer presses Blockquote, Checkbox or Option, or runs Bulleted list or Numbered list from the slash menu, the extension SHALL put the prefix of that action in front of the touched lines, or remove it when every touched line already has it, in one undoable step.

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

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

Scenarios 5

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

nominalBlockquote quotes a list and keeps blank lines
Giventhe selection of two list lines - a and - b
a selection of a, a blank line and b
WhenBlockquote is pressed
Blockquote is pressed
Thenboth lines start with > before the list marker
the lines a and b get > and the blank line gets a bare >; a single blank line gets > followed by a space
InputOutcome
`a|bc``> a|bc`
`> a|bc``a|bc`
`>> a|``> a|` (one level removed)
`[- a` newline `- b]``[> - a` newline `> - b]`
`[> - a` newline `> - b]``[- a` newline `- b]`
`[1. a` newline ` 2. b]``[> 1. a` newline `> 2. b]`
`x` newline `[a` newline `b]` newline `y`only the touched lines a and b get `> `
`[a` newline `> b]` (one line already quoted)`[> a` newline `> > b]`
`|``> |`
`> |``|`
`[a` newline `]b` (selection ending at a line start)`[> a` newline `]b` (the line b is not touched)
nominalBulleted list and Numbered list from the slash menu
Giventhe selection of a, b and c on three lines
the selection of a, a blank line and b
a block editor in the strict mode
a block editor in the strict, gfm or myst mode
WhenBulleted list runs
Numbered list runs
the writer types / and lists the commands
the writer types /bullet and presses Enter
Theneach line starts with a dash and a space; when it runs again the markers are removed, and on an empty single line the marker is inserted with the caret after it
the lines read 1. a and 2. b and the blank line is unchanged; when it runs again the markers are removed
Bulleted list and Numbered list are in the list
the text gets the prefix `- ` on a new line after the line Intro, as one edit
InputOutcome
Bulleted list: empty text, caret at 0`- ` with the caret after it
Bulleted list: `a`, blank line, caret on the last empty line`a`, blank line, `- ` with the caret after it
Bulleted list: `item` with the caret in it`- item`
Bulleted list: `one`, blank line, `two` all selected`- one`, blank line, `- two` (blank lines stay blank)
Bulleted list: `- one` newline `- two` all selected`one` newline `two` (toggled off)
Bulleted list: `1. one` newline `2. two` all selected`- one` newline `- two` (a numbered marker is replaced)
Bulleted list: `- one` newline `two` all selected`- one` newline `- two` (a mixed selection adds)
Bulleted list: a marker written with `*` or `+`counts as present
Numbered list: empty text, caret at 0`1. ` with the caret after it
Numbered list: `a`, `b`, blank line, `c` all selected`1. a`, `2. b`, blank line, `3. c`
Numbered list: `1. a` newline `2. b` all selected`a` newline `b`
Numbered list: `- a` newline `- b` all selected`1. a` newline `2. b` (a bullet marker is replaced)
Numbered list: `word` with the caret at its end`1. word`
Numbered list: `/numbered` typed in the gfm mode, then Tabthe text gets the prefix `1. ` as one edit
refusalNo palette button for the list actions
Giventhe same editor
Whenthe buttons of the palette are listed
Thenneither Bulleted list nor Numbered list appears as a button, they have no shortcut, and a table cell menu does not list them
nominalCheckbox toggles a task list box
Givena plain line and a list item
lines that all have a checked or unchecked box
WhenCheckbox is pressed on each
Checkbox is pressed
Thenthe plain line gets - [ ] and the item gets [ ] after its marker, with the caret kept on its text
all boxes are removed and the list items stay
InputOutcome
Several touched lines, all with a boxAll boxes lose it (one action for the lines)
Several touched lines, not all with a boxAll lines get one
An empty lineThe box is inserted with the caret after it
A list item, Checkbox pressed twiceThe text is back as before (its own inverse)
Checkbox pressed in the text boxThe text box is edited as one undo step
nominalOption toggles a choice list marker
Givena plain line and a list item (the GFM and MyST palettes show the Option button next to Checkbox)
lines that all start with a choice marker ( ), (x) or (X) after their list marker
WhenOption is pressed on each
Option is pressed
Thenthe plain line gets - ( ) and the item gets ( ) after its marker, with the caret kept on its text
every marker is removed and the list items stay
InputOutcome
Several touched lines, all with a choice markerAll markers are removed (one action for the lines)
Several touched lines, not all with a choice markerAll lines get one
A line with a task box, as in - [ ] aThe box is replaced by the choice marker
An empty lineThe marker is inserted with the caret after it
A list item, Option pressed twiceThe text is back as before (its own inverse)
Option pressed in the text boxThe text box is edited as one undo step

Implemented in 2

Tested by 5

Replaces

SwRS-MDOKFSTUDIO-PALETTE-049Blockquote prefixes the touched lines or removes one quote level superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-277 Markdown file
SwRS-MDOKFSTUDIO-PALETTE-052Bulleted list toggles a dash prefix, from the slash menu only superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-277 Markdown file
SwRS-MDOKFSTUDIO-PALETTE-053Numbered list numbers the touched non-blank lines superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-277 Markdown file
SwRS-MDOKFSTUDIO-PALETTE-123Checkbox toggles a task list box on the touched lines superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-277 Markdown file
SwRS-MDOKFSTUDIO-PALETTE-267Option toggles a choice list marker on the touched lines superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-277 Markdown file