PDF

blockstblockst0.4.0

Render Scratch, Blockly, MakeCode and Open Roberta blocks for educational documents.

The notation#

Blocks are written one per line, the way they read in the editor. Inputs are marked by their brackets, a body is indented and closed by an end marker. The vocabulary is the editor’s own in the chosen language — the parser matches against Scratch’s translations, Blockly’s message files or the MakeCode editors’ strings, and a line it does not recognise is drawn as written in a neutral grey (or in the colour of a category you name, see below).

PatternExampleDescription
Stack blockmove (10) stepsA command; blocks on consecutive lines snap together
Hat blockwhen green flag clickedAn event; starts a new script
Reporter(x position)A value with round ends
Boolean<mouse down?>A condition with pointed ends
Input: number(10)Numeric input field
Input: string[hello]String input field
Input: dropdown[random position v]Dropdown selector — the v marks it
Empty input(), [], <>An empty slot
C-blockrepeat (4)endA block with a body: indent the body, close it with the end marker
C-block with elseif <…> thenelseendA second body after the else marker
Icon@greenFlag, @turnRight, @turnLeftThe flag and the turn arrows
Line labelmove (10) steps #stepNames the line, see Labels and line numbers

What differs between the editors is small and follows the editor: