Behaviour SwRS-MDOKFSTUDIO-CODE-007
Code blocks use one font scale, one box and scroll long lines
When a code block is shown, the extension SHALL style the block with the editor foreground colour, a font size of 0.92em, a 4 px radius, a border and the code-block background, scroll a line wider than the block inside it outside Auto width mode, and keep the background soft and readable in the forced white and cream themes.
Part of StRS-MDOKFSTUDIO-CODE-001, outside the paths drawn on its map.
Scenarios 5
The situations the tests check; open one to read it.
nominalFenced blocks share one style
Givenany fenced block in the preview
Whenthe page renders
Thenthe block has the editor foreground colour, a font size of 0.92em, the code-block background, border and a 4 px radius, and the inner code has no own box
boundaryA nested block has the same style
Givena block nested in a list or admonition
Whenthe page renders
Thenit uses the same style as a top-level block
nominalA long line scrolls inside its block
Givena Python block with a very long line in a 460 px panel outside Auto width mode
Whenthe reader scrolls the block to the right
Thenthe line's far end becomes visible and the page has no horizontal overflow
boundaryAn exact-fit line needs no scrollbar
Givena block whose longest line is exactly as wide as the block
Whenthe preview renders it
Thenthe block shows no horizontal scrollbar and the page has no overflow
boundaryForced white and cream themes
| Forced theme | Outcome |
|---|---|
| cream, with a Python block | The block has a soft background and readable text while the dark background setting is off; by default it is the Dark+ surface (SwRS-MDOKFSTUDIO-CODE-040) |
| white, with a Python block | The text stays readable on the soft background while the dark background setting is off |
Implemented in 1
Tested by 3
Replaces
SwRS-MDOKFSTUDIO-CODE-012Style fenced code blocks with one font scale and the code background superseded superseded by SwRS-MDOKFSTUDIO-CODE-007 Markdown file
SwRS-MDOKFSTUDIO-CODE-013Scroll long code lines inside their block superseded superseded by SwRS-MDOKFSTUDIO-CODE-007 Markdown file
SwRS-MDOKFSTUDIO-CODE-016Keep code backgrounds soft and readable in the forced white and cream themes superseded superseded by SwRS-MDOKFSTUDIO-CODE-007 Markdown file