You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The package repository for Typst, where package authors submit their packages.
3
3
The packages submitted here are available on [Typst Universe][universe].
4
4
5
-
## Package format
6
-
A package is a collection of Typst files and assets that can be imported as a
7
-
unit. A `typst.toml` manifest with metadata is required at the root of a
8
-
package. An example manifest could look like this:
9
-
10
-
```toml
11
-
[package]
12
-
name = "example"
13
-
version = "0.1.0"
14
-
entrypoint = "lib.typ"
15
-
authors = ["The Typst Project Developers"]
16
-
license = "MIT"
17
-
description = "An example package."
18
-
```
19
-
20
-
Required by the compiler:
21
-
-`name`: The package's identifier in its namespace.
22
-
-`version`: The package's version as a full major-minor-patch triple.
23
-
Package versioning should follow [SemVer].
24
-
-`entrypoint`: The path to the main Typst file that is evaluated when the
25
-
package is imported.
26
-
27
-
Required for submissions to this repository:
28
-
-`authors`: A list of the package's authors. Each author can provide an email
29
-
address, homepage, or GitHub handle in angle brackets. The latter must start
30
-
with an `@` character, and URLs must start with `http://` or `https://`.
31
-
-`license`: The package's license. Must contain a valid SPDX-2 expression
32
-
describing one or multiple licenses that are either [OSI-approved][OSI]
33
-
licenses or a version of CC-BY, CC-BY-SA, or CC0. We recommend you do not
34
-
license your package using a Creative Commons license unless it is a
35
-
derivative work of a CC-BY-SA-licensed work or if it is not primarily code,
36
-
but content or data. In most other cases, [a free/open license specific to
37
-
software is better suited for Typst packages](https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software).
38
-
-`description`: A short description of the package. Double-check this for
39
-
grammar and spelling mistakes as it will appear in the [package list][list].
40
-
41
-
Optional:
42
-
-`homepage`: A link to the package's web presence, where there could be more
43
-
details, an issue tracker, or something else. Will be linked to from the
44
-
package list.
45
-
-`repository`: A link to the repository where this package is developed. Will
46
-
be linked to from the package list if there is no homepage.
47
-
-`keywords`: An array of search keywords for the package.
48
-
-`categories`: An array with up to three categories from the
49
-
[list of categories][categories] to help users discover the package.
50
-
-`disciplines`: An array of [disciplines] defining the target audience for
51
-
which the package is useful. Should be empty if the package is generally
52
-
applicable.
53
-
-`compiler`: The minimum Typst compiler version required for this package to
54
-
work.
55
-
-`exclude`: An array of globs specifying files that should not be part of the
56
-
published bundle that the compiler downloads when importing the package. To be
57
-
used for large support files like images or PDF documentation that would
58
-
otherwise unnecessarily increase the bundle size. Don't exclude the README or
59
-
the LICENSE.
60
-
61
-
Packages always live in folders named as `{name}/{version}`. The name and
62
-
version in the folder name and manifest must match. Paths in a package are local
63
-
to that package. Absolute paths start in the package root, while relative paths
64
-
are relative to the file they are used in.
65
-
66
-
### Templates
67
-
Packages can act as templates for user projects. In addition to the module that
68
-
a regular package provides, a template package also contains a set of template
69
-
files that Typst copies into the directory of a new project.
70
-
71
-
In most cases, the template files should not include the styling code for the
72
-
template. Instead, the template's entrypoint file should import a function from
73
-
the package. Then, this function is used with a show rule to apply it to the
74
-
rest of the document.
75
-
76
-
Template packages (also informally called templates) must declare the
77
-
`[template]` key in their `typst.toml` file. A template package's `typst.toml`
78
-
could look like this:
79
-
80
-
```toml
81
-
[package]
82
-
name = "charged-ieee"
83
-
version = "0.1.0"
84
-
entrypoint = "lib.typ"
85
-
authors = ["Typst GmbH <https://typst.app>"]
86
-
license = "MIT-0"
87
-
description = "An IEEE-style paper template to publish at conferences and journals for Electrical Engineering, Computer Science, and Computer Engineering"
88
-
89
-
[template]
90
-
path = "template"
91
-
entrypoint = "main.typ"
92
-
thumbnail = "thumbnail.png"
93
-
```
94
-
95
-
Required by the compiler:
96
-
-`path`: The directory within the package that contains the files that should
97
-
be copied into the user's new project directory.
98
-
-`entrypoint`: A path _relative to the template's path_ that points to the file
99
-
serving as the compilation target. This file will become the previewed file in
100
-
the Typst web application.
101
-
102
-
Required for submissions to this repository:
103
-
-`thumbnail`: A path relative to the package's root that points to a PNG or
104
-
lossless WebP thumbnail for the template. The thumbnail must depict one of the
105
-
pages of the template **as initialized.** The longer edge of the image must be
106
-
at least 1080px in length. Its file size must not exceed 3MB. Exporting a PNG
107
-
at 250 DPI resolution is usually a good way to generate a thumbnail. You are
108
-
encouraged to use [oxipng] to reduce the thumbnail's file size. The thumbnail
109
-
will automatically be excluded from the package files and must not be
110
-
referenced anywhere in the package.
111
-
112
-
Template packages must specify at least one category in `package.categories`.
113
-
114
-
If you're submitting a template, please test that it works locally on your
115
-
system. The recommended workflow for this is as follows:
116
-
117
-
- Add a symlink from `$XDG_DATA_HOME/typst/packages/preview` to the `preview`
118
-
folder of your fork of this repository (see the section on [local
119
-
packages](#local-packages)).
120
-
- Run `typst init @preview/mypkg:version`. Note that you must manually specify
121
-
the version as the package is not yet in the index, so the latest version
122
-
won't be detected automatically.
123
-
- Compile the freshly instantiated template.
124
-
125
-
### Third-party metadata
126
-
Third-party tools can add their own entry under the `[tool]` section to attach
127
-
their Typst-specific configuration to the manifest.
128
-
129
-
```toml
130
-
[package]
131
-
# ...
132
-
133
-
[tool.mytool]
134
-
foo = "bar"
135
-
```
136
-
137
5
## Published packages
138
6
This repository contains a collection of published packages. Due to its early
139
7
and experimental nature, all packages in this repository are scoped in a
@@ -146,98 +14,6 @@ You can use template packages to create new Typst projects with the CLI with
146
14
the `typst init` command or the web application by clicking the _Start from
147
15
template_ button.
148
16
149
-
### Submission guidelines
150
-
To submit a package, simply make a pull request with the package to this
151
-
repository. There are a few requirements for getting a package published, which
152
-
are detailed below:
153
-
154
-
-**Naming:** Package names should not be the obvious or canonical name for a
155
-
package with that functionality (e.g. `slides` is forbidden, but `sliding` or
156
-
`slitastic` would be ok). We have this rule because users will find packages
157
-
with these canonical names first, creating an unfair advantage for the package
158
-
author who claimed that name. Names should not include the word "typst" (as it
159
-
is redundant). If they contain multiple words, names should use `kebab-case`.
160
-
Look at existing packages and PRs to get a feel for what's allowed and what's
161
-
not.
162
-
163
-
*Additional guidance for template packages:* It is often desirable for
164
-
template names to feature the name of the organization or publication the
165
-
template is intended for. However, it is still important to us to accommodate
166
-
multiple templates for the same purpose. Hence, template names shall consist
167
-
of a unique, non-descriptive part followed by a descriptive part. For example,
168
-
a template package for the fictitious _American Journal of Proceedings (AJP)_
169
-
could be called `organized-ajp` or `eternal-ajp`. Package names should be
170
-
short and use the official entity abbreviation. Template authors are
171
-
encouraged to add the full name of the affiliated entity as a keyword.
172
-
173
-
The unamended entity name (e.g. `ajp`) is reserved for official template
174
-
packages by their respective entities. Please make it clear in your PR if you
175
-
are submitting an official package. We will then outline steps to authenticate
176
-
you as a member of the affiliated organization.
177
-
178
-
If you are an author of an original template not affiliated with any
179
-
organization, only the standard package naming guidelines apply to you.
180
-
181
-
-**Functionality:** Packages should conceivably be useful to other users and
182
-
should expose their capabilities in a reasonable fashion.
183
-
184
-
-**Documentation:** Packages must contain a `README.md` file documenting (at
185
-
least briefly) what the package does and all definitions intended for usage by
186
-
downstream users. Examples in the README should show how to use the package
187
-
through an `@preview` import. If you have images in your README, you might
188
-
want to check whether they also work in dark mode. Also consider running
189
-
[`typos`][typos] through your package before release.
190
-
191
-
-**Style:** No specific code style is mandated, but two spaces of indent and
192
-
kebab-case for variable and function names are recommended.
193
-
194
-
-**License:** Packages must be licensed under the terms of an
195
-
[OSI-approved][OSI] license. In addition to specifying the license in the
196
-
TOML manifest, a package must either contain a `LICENSE` file or link to one
197
-
in its `README.md`.
198
-
199
-
*Additional details for template packages:* If you expect the package
200
-
license's provisions to apply to the contents of the template directory (used
201
-
to scaffold a project) after being modified through normal use, especially if
202
-
it still meets the _threshold of originality,_ you must ensure that users of
203
-
your template can use and distribute the modified contents without
204
-
restriction. In such cases, we recommend licensing at least the template
205
-
directory under a license that requires neither attribution nor distribution
206
-
of the license text. Such licenses include MIT-0 and Zero-Clause BSD. You can
207
-
use an SPDX AND expression to selectively apply different licenses to parts of
208
-
your package. In this case, the README or package files must make clear under
209
-
which license they fall. If you explain the license distinction in the README
210
-
file, you must not exclude it from the package.
211
-
212
-
-**Size:** Packages should not contain large files or a large number of files.
213
-
This will be judged on a case-by-case basis, but if it needs more than ten
214
-
files, it should be well-motivated. To keep the package small and fast to
215
-
download, please `exclude` images for the README or PDF files with
216
-
documentation from the bundle. Alternatively, you can link to images hosted on
217
-
a githubusercontent.com URL (just drag the image into an issue).
218
-
219
-
-**Security:** Packages must not attempt to exploit the compiler or packaging
220
-
implementation, in particular not to exfiltrate user data.
221
-
222
-
-**Safety:** Names and package contents must be safe for work.
223
-
224
-
This list may be extended over time as improvements/issues to the process are
225
-
discovered. Given a good reason, we reserve the right to reject any package submission.
226
-
227
-
When a package's PR has been merged and CI has completed, the package will be
228
-
available for use. However, it can currently take a longer while until the
229
-
package will be visible on [Typst Universe][universe]. We'll reduce this delay
230
-
in the future.
231
-
232
-
Once submitted, a package will not be changed or removed without good reason to
233
-
prevent breakage for downstream consumers. By submitting a package, you agree
234
-
that it is here to stay. If you discover a bug or issue, you can of course
235
-
submit a new version of your package.
236
-
237
-
There is one exception: Minor fixes to the documentation or TOML metadata of a
238
-
package are allowed _if_ they can not affect the package in a way that might
239
-
break downstream users.
240
-
241
17
### Downloads
242
18
The Typst compiler downloads packages from the `preview` namespace on-demand.
243
19
Once used, they are cached in `{cache-dir}/typst/packages/preview` where
@@ -249,7 +25,7 @@ Once used, they are cached in `{cache-dir}/typst/packages/preview` where
249
25
250
26
Importing a cached package does not result in network access.
251
27
252
-
## Local packages
28
+
###Local packages
253
29
Want to install a package locally on your system without publishing it or
254
30
experiment with it before publishing? You can store packages in
255
31
`{data-dir}/typst/packages/{namespace}/{name}/{version}` to make them available
@@ -269,16 +45,20 @@ system-local packages is `local`:
269
45
Note that future iterations of Typst's package management may change/break this
270
46
local setup.
271
47
48
+
49
+
## Documentation for authors of Typst packages
50
+
If you want to write your own Typst packages and share them on this repository.
51
+
please see our more detailed documentation pages:
52
+
53
+
-[Packaging guidelines](doc/packaging-guidelines.md): the rules that Typst packages should follow. You should
54
+
start with this, in particular there are guidelines on the choice of package name.
55
+
-[Package content](doc/package-content.md): the layout and content of Typst packages, and the format of `typst.toml`.
56
+
-[Submitting a package](doc/submitting-a-package.md): the concrete process to submit a package to this repository.
57
+
58
+
272
59
## License
273
60
The infrastructure around the package repository is licensed under the terms of
274
61
the Apache-2.0 license. Packages in `packages/` are licensed under their
0 commit comments