Contributing to Loom
Help us weave the future of Typst.
First of all, thank you! Loom is an ambitious project trying to push the boundaries of what is possible in Typst. However, to maintain the quality and stability of the core library with limited maintainer bandwidth, we adhere to very strict contribution guidelines.
Please read this document carefully. Contributions that do not follow these rules will be closed without review.
Reporting Bugs​
Loom is complex. To save everyone time, we require a high standard for bug reports.
- Strictly Minimal Reproductions: You must provide a minimal code snippet that reproduces the error. If we cannot copy-paste your code and see the error immediately, the issue will be closed.
- No External Packages: Issues must be reproduced using only
loomand standard Typst elements. We will not investigate issues caused by interactions with other packages (e.g.,codly,showybox) unless you can prove the bug exists in Loom's core logic in isolation. - Check the logs: Run your reproduction with
debug: trueand include the output. - Version: State clearly which version of Loom and Typst you are using.
Good Issue Title: "Infinite loop when nesting data-motif inside table header"
Bad Issue Title: "My document doesn't compile"
Development Setup​
We use Nix to manage our development environment and dependencies strictly. This ensures that every contributor uses the exact same version of Typst, the test runner, and the formatter.
-
Clone the repository:
git clone https://github.com/leonieziechmann/loom.git
cd loom -
Enter the Environment: You must use the Nix flake to get the required tools (
tytanic,typstyle,pre-commit, etc.).- Option A (Recommended): If you have
nix direnvinstalled:direnv allow - Option B: Using Nix directly:
nix develop
- Option A (Recommended): If you have
-
Pre-commit Hooks: We enforce strict code formatting using pre-commit hooks. The environment handles this automatically, but you can verify it by running:
pre-commit run --all-filesPRs with styling errors will be rejected automatically.
Testing​
We use Tytanic for testing. New features must include tests. PRs without tests will be closed.
# Run the complete test suite
tt run
Core Philosophy​
When contributing code, adhere to these principles. Code that violates them will be rejected.
- Defensive Programming:
Loom runs in a hostile environment. Assume the user will pass
none, invalid keys, or try to nest things incorrectly.
- Always provide helpful error messages using
assertorpanic.
- Performance First: Every function in the "hot path" is executed thousands of times.
- Avoid deep copies of Context.
- Avoid unnecessary loop allocations.
- Backward Compatibility: Do not break the public API.
Pull Request Process​
- Fork the repo and create your branch from
main. - Add Tests covering your changes.
- Format your code. The pre-commit hooks enforce Typstyle for
.typfiles and Prettier for Markdown. - Submit the PR.
Note: If your PR fails the CI checks (formatting or tests), do not expect a review until they are fixed.
Documentation​
Documentation is required for new features. The Nix environment provides the Node.js runtime needed for Docusaurus.
cd docs
npm install
npm start