Behaviour SwRS-MDOKFSTUDIO-BLOCK-256
The host refuses a block edit whose first line is blank
When a block edit (open, autosave or Done) names a range whose first line is blank, the host SHALL answer with an error telling that the preview and the document disagree about the block's lines, open no editor and change nothing.
Part of StRS-MDOKFSTUDIO-BLOCK-006, outside the paths drawn on its map.
Scenarios 4
The situations the tests check; open one to read it.
refusalA range shifted onto a blank line
Givena document whose heading "### Edit MyST visually" is on line 12 and a page that sends the range 11 to 12, as a line shift of the preview did for the blocks after a GitHub alert
Whenthe page opens the block editor, or saves it with Done or an autosave
Thenthe host answers with "The preview and the document disagree about this block's lines. Refresh the preview and try again.", opens no editor and the document text is unchanged
refusalRanges outside the document keep their own reason
| Input | Outcome |
|---|---|
| A range that ends after the last line of the document | Refused as stale, see SwRS-MDOKFSTUDIO-BLOCK-216, and nothing changes |
| A range whose first line is blank | Refused with the reason above |
nominalBlocks with blank lines inside are edited
Givenblocks that contain blank lines (a fenced code block, a diagram fence, a directive or admonition, a list-table, a loose list, a blockquote, a GFM alert, an HTML block) with the ranges the renderer gives them
Whenthe page opens the block editor on one of them
Thenthe host answers with the exact text of the range and no error
nominalA list ends on its blank separator
Givena list or list item whose rendered range ends on the blank line that follows it
Whenthe page opens the block editor on it
Thenthe host accepts the range; only the first line of a range is checked for blank, not its last