diff options
Diffstat (limited to 'docs/src/reference')
| -rw-r--r-- | docs/src/reference/details.yml | 8 | ||||
| -rw-r--r-- | docs/src/reference/scripting.md | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/docs/src/reference/details.yml b/docs/src/reference/details.yml index 22b67963..8e9af3a0 100644 --- a/docs/src/reference/details.yml +++ b/docs/src/reference/details.yml @@ -164,3 +164,11 @@ data-loading: | utility: | Useful utility functions. + +packages: | + Typst [packages]($scripting/#packages) encapsulate reusable building blocks + and make them reusable across projects. Below is a list of Typst packages + created by the community. Due to the early and experimental nature of Typst's + package management, they all live in a `preview` namespace. Click on a + package's name to view its documentation and use the copy button on the right + to get a full import statement for it. diff --git a/docs/src/reference/scripting.md b/docs/src/reference/scripting.md index cb48b52a..c18bdc4b 100644 --- a/docs/src/reference/scripting.md +++ b/docs/src/reference/scripting.md @@ -294,6 +294,25 @@ the following example: #face.grin ``` +## Packages { #packages } +To reuse building blocks across projects, you can also create and import Typst +_packages._ A package import is specified as a triple of a namespace, a name, +and a version. + +```example +>>> #let add(x, y) = x + y +<<< #import "@preview/example:0.1.0": add +#add(2, 7) +``` + +The `preview` namespace contains packages shared by the community. You can find +a searchable list of available community packages in the [packages]($packages) +section. + +If you are using Typst locally, you can also create your own system-local +packages. For more details on this, see the +[package repository](https://github.com/typst/packages). + ## Operators { #operators } The following table lists all available unary and binary operators with effect, arity (unary, binary) and precedence level (higher binds stronger). @@ -322,3 +341,5 @@ arity (unary, binary) and precedence level (higher binds stronger). | `{-=}` | Subtraction-Assignment | Binary | 1 | | `{*=}` | Multiplication-Assignment | Binary | 1 | | `{/=}` | Division-Assignment | Binary | 1 | + +[semver]: https://semver.org/ |
