Scratchblock
The scratchblock element allows to easier inserting of scratch programs. The programs will be rendered as a svg.
As a default your hyperbook language and english are supported.
Attributes
| Attribute | Description | Default |
|---|---|---|
language |
Scratchblocks locale to use, for example de |
hyperbook language / en |
:::scratchblock
when green flag clicked
move (1) steps
:::
when green flag clicked move (1) steps
A block inside text
With one colon, a single block sits inside a sentence or a table cell:
| Scratch | Java |
| --- | --- |
| :scratchblock[move (10) steps] | `move(10);` |
| :scratchblock[say [Hello!] for (2) seconds] | `say("Hello!", 2);` |
| Scratch | Java |
|---|---|
| move (10) steps | move(10); |
| say [Hello!] for (2) seconds | say("Hello!", 2); |
The text between the brackets is read as scratchblocks code, not as Markdown, so brackets, underscores and stars stay as they are.
Languages
You can add a specific language by providing a language parameter.
:::scratchblock{language="de"}
Wenn die grΓΌne Flagge angeklickt
gehe (1) er Schritt
drehe dich nach rechts um (15) Grad
:::
Wenn die grΓΌne Flagge angeklickt gehe (1) er Schritt drehe dich nach rechts um (15) Grad
You can find the support languages and the corresponding commands here: https://github.com/scratchblocks/scratchblocks/tree/main/locales