Skip to content

blockst:0.1.0#4389

Merged
elegaanz merged 8 commits intotypst:mainfrom
Loewe1000:add-blockst-0.1.0
Mar 24, 2026
Merged

blockst:0.1.0#4389
elegaanz merged 8 commits intotypst:mainfrom
Loewe1000:add-blockst-0.1.0

Conversation

@Loewe1000
Copy link
Copy Markdown
Contributor

I am submitting

  • a new package
  • an update for a package

Description: Blockst renders Scratch-style programming blocks directly in Typst documents. It is useful for worksheets, teaching materials, tutorials, and visual explanations of programming concepts.

The package provides:

  • block rendering for Scratch-like scripts
  • support for nested control structures, reporters, operators, variables, lists, and custom blocks
  • localized language APIs for German, English, and French
  • Scratch-Run helpers for executable turtle-graphics style drawings

I tested the package locally and included documentation, examples, license information, and package metadata required for submission.

I have read and followed the submission guidelines and, in particular, I

  • selected a name that isn't the most obvious or canonical name for what the package does
  • added a typst.toml file with all required keys
  • added a README.md with documentation for my package
  • have chosen a license and added a LICENSE file or linked one in my README.md
  • tested my package locally on my system and it worked
  • excluded PDFs or README images, if any, but not the LICENSE

@typst-package-check typst-package-check bot changed the title blockst 0.1.0 blockst:0.1.0 Mar 17, 2026
@typst-package-check typst-package-check bot added the new A new package submission. label Mar 17, 2026
Copy link
Copy Markdown
Member

@elegaanz elegaanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the package. I have left some comments :)


---

## Project Structure
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this section is so relevant to people wanting to use the package, who will be reading this README on Typst Universe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! The "Project Structure", "Extensibility", "Adding a New Language", and the full function reference sections have been removed from the README. It now focuses purely on usage: quick start, examples, and the block catalog. Internal architecture details are better suited for the repository wiki or source comments.

#import "@preview/blockst:0.1.0": blockst, scratch

#blockst[
#import scratch.de: *
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some examples use English, some others German. I think it would be best to stick to English and only showcase German and French in a single example, to show people that this alternative API exists and what it looks like.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! The README has been fully restructured. All examples now use English, with a single dedicated "German & French Localization" section that shows both localised APIs side by side, so readers can see what the alternative looks like without it dominating the examples.


---

## Available Categories
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these functions should be document in English if only in one language. Otherwise, having the full reference in the three language could be a possibility.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The per-language function lists (the old "Available Categories" section listing gehe(schritte:) / move(steps:) etc.) have been replaced by a visual block catalog. Each category now has an expandable <details> section with an SVG showing all blocks with their English function signatures. This covers the full English reference visually, without duplicating three language variants in plain text.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Definiere" seems to be in German here, I'm not sure why.

Copy link
Copy Markdown
Contributor Author

@Loewe1000 Loewe1000 Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — this was a bug: the define() / definiere() block had the verb hardcoded as German ("Definiere") in the rendering layer instead of going through the translation system. It's now fixed: the label is looked up from the TOML translation files, so French uses "Définir", English uses "Define", and German uses "Definiere".

#avancer(pas: 10)
#si-alors-sinon(
toucher-objet("bord"),
[#tourner-à-droite(degres: 180)],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason some calls are wrapped in a content block (i.e [#function()] instead of #function())?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there was a reason — but it was actually unnecessary and has been cleaned up. The [#function()] content block syntax was used to group multiple statements in branches, but single-statement calls don't need it. The examples and documentation now consistently use #function() directly for single statements, and only [#a() #b()] when multiple statements need to be grouped. A dedicated example ("Content Blocks: When to Use [...]") in the README explains the distinction.

Copy link
Copy Markdown
Member

@elegaanz elegaanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking my remarks into account. I just added a small remark about the example you just added, once it's fixed it should be good to be merged.

#set-blockst(font: "Comic Sans MS")

#blockst[
#import "../libs/scratch/lang/en.typ": *
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should import scratch.en: * too I think.

@elegaanz
Copy link
Copy Markdown
Member

Thank you!

@elegaanz elegaanz merged commit 719ac26 into typst:main Mar 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new A new package submission.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants