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
Copy file name to clipboardexpand all lines: .github/pull_request_template.md
+5
Original file line number
Diff line number
Diff line change
@@ -25,3 +25,8 @@ I have read and followed the submission guidelines and, in particular, I
25
25
-[ ] have chosen a license and added a `LICENSE` file or linked one in my `README.md`
26
26
-[ ] tested my package locally on my system and it worked
27
27
-[ ]`exclude`d PDFs or README images, if any, but not the LICENSE
28
+
29
+
<!--
30
+
The following box only needs to be checked for **template** submissions. If you're submitting a package that isn't a template, you can delete the following section. See the guidelines section about licenses in the README for more details.
31
+
-->
32
+
-[ ] ensured that my package is licensed such that users can use and distribute the contents of its template directory without restriction, after modifying them through normal use.
Copy file name to clipboardexpand all lines: README.md
+106-22
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ name = "example"
13
13
version = "0.1.0"
14
14
entrypoint = "lib.typ"
15
15
authors = ["The Typst Project Developers"]
16
-
license = "Unlicense"
16
+
license = "MIT"
17
17
description = "An example package."
18
18
```
19
19
@@ -34,12 +34,17 @@ Required for submissions to this repository:
34
34
grammar and spelling mistakes as it will appear in the [package list][list].
35
35
36
36
Optional:
37
-
-`homepage`: A link to the package's web presence where there could be more
37
+
-`homepage`: A link to the package's web presence, where there could be more
38
38
details, an issue tracker, or something else. Will be linked to from the
39
39
package list.
40
40
-`repository`: A link to the repository where this package is developed. Will
41
41
be linked to from the package list if there is no homepage.
42
42
-`keywords`: An array of search keywords for the package.
43
+
-`categories`: An array with up to three categories from the
44
+
[list of categories][categories] to help users discover the package.
45
+
-`disciplines`: An array of [disciplines] defining the target audience for
46
+
which the package is useful. Should be empty if the package is generally
47
+
applicable.
43
48
-`compiler`: The minimum Typst compiler version required for this package to
44
49
work.
45
50
-`exclude`: An array of globs specifying files that should not be part of the
@@ -48,6 +53,60 @@ Optional:
48
53
otherwise unnecessarily increase the bundle size. Don't exclude the README or
49
54
the LICENSE.
50
55
56
+
Packages always live in folders named as `{name}/{version}`. The name and
57
+
version in the folder name and manifest must match. Paths in a package are local
58
+
to that package. Absolute paths start in the package root, while relative paths
59
+
are relative to the file they are used in.
60
+
61
+
### Templates
62
+
Packages can act as templates for user projects. In addition to the module that
63
+
a regular package provides, a template package also contains a set of template
64
+
files that Typst copies into the directory of a new project.
65
+
66
+
In most cases, the template files should not include the styling code for the
67
+
template. Instead, the template's entrypoint file should import a function from
68
+
the package. Then, this function is used with a show rule to apply it to the
69
+
rest of the document.
70
+
71
+
Template packages (also informally called templates) must declare the
72
+
`[template]` key in their `typst.toml` file. A template package's `typst.toml`
73
+
could look like this:
74
+
75
+
```toml
76
+
[package]
77
+
name = "charged-ieee"
78
+
version = "0.1.0"
79
+
entrypoint = "lib.typ"
80
+
authors = ["Typst GmbH <https://typst.app>"]
81
+
license = "MIT-0"
82
+
description = "An IEEE-style paper template to publish at conferences and journals for Electrical Engineering, Computer Science, and Computer Engineering"
83
+
84
+
[template]
85
+
path = "template"
86
+
entrypoint = "main.typ"
87
+
thumbnail = "thumbnail.png"
88
+
```
89
+
90
+
Required by the compiler:
91
+
-`path`: The directory within the package that contains the files that should
92
+
be copied into the user's new project directory.
93
+
-`entrypoint`: A path _relative to the template's path_ that points to the file
94
+
serving as the compilation target. This file will become the previewed file in
95
+
the Typst web application.
96
+
97
+
Required for submissions to this repository:
98
+
-`thumbnail`: A path relative to the package's root that points to a PNG or
99
+
lossless WebP thumbnail for the template. The thumbnail must depict one of the
100
+
pages of the template **as initialized.** The longer edge of the image must be
101
+
at least 1080px in length. Its file size must not exceed 3MB. Exporting a PNG
102
+
at 250 DPI resolution is usually a good way to generate a thumbnail. You are
103
+
encouraged to use [oxipng] to reduce the thumbnail's file size. The thumbnail
104
+
will automatically be excluded from the package files and must not be
105
+
referenced anywhere in the package.
106
+
107
+
Template packages must specify at least one category in `package.categories`.
108
+
109
+
### Third-party metadata
51
110
Third-party tools can add their own entry under the `[tool]` section to attach
52
111
their Typst-specific configuration to the manifest.
53
112
@@ -59,11 +118,6 @@ their Typst-specific configuration to the manifest.
59
118
foo = "bar"
60
119
```
61
120
62
-
Packages always live in folders named as `{name}/{version}`. The name and
63
-
version in the folder name and manifest must match. Paths in a package are local
64
-
to that package. Absolute paths start in the package root while relative paths
65
-
are relative to the file they are used in.
66
-
67
121
## Published packages
68
122
This repository contains a collection of published packages. Due to its early
69
123
and experimental nature, all packages in this repository are scoped in a
@@ -72,6 +126,10 @@ and experimental nature, all packages in this repository are scoped in a
72
126
Typst as `#import "@preview/{name}:{version}"`. You must always specify the full
73
127
package version.
74
128
129
+
You can use template packages to create new Typst projects with the CLI with
130
+
the `typst init` command or the web application by clicking the _Start from
131
+
template_ button.
132
+
75
133
### Submission guidelines
76
134
To submit a package, simply make a pull request with the package to this
77
135
repository. There are a few requirements for getting a package published, which
@@ -85,28 +143,66 @@ are detailed below:
85
143
is redundant). If they contain multiple words, names should use `kebab-case`.
86
144
Look at existing packages and PRs to get a feel for what's allowed and what's
87
145
not.
146
+
147
+
*Additional guidance for template packages:* It is often desirable for
148
+
template names to feature the name of the organization or publication the
149
+
template is intended for. However, it is still important to us to accommodate
150
+
multiple templates for the same purpose. Hence, template names shall consist
151
+
of a unique, non-descriptive part followed by a descriptive part. For example,
152
+
a template package for the fictitious _American Journal of Proceedings (AJP)_
153
+
could be called `organized-ajp` or `eternal-ajp`. Package names should be
154
+
short and use the official entity abbreviation. Template authors are
155
+
encouraged to add the full name of the affiliated entity as a keyword.
156
+
157
+
The unamended entity name (e.g. `ajp`) is reserved for official template
158
+
packages by their respective entities. Please make it clear in your PR if you
159
+
are submitting an official package. We will then outline steps to authenticate
160
+
you as a member of the affiliated organization.
161
+
162
+
If you are an author of an original template not affiliated with any
163
+
organization, only the standard package naming guidelines apply to you.
164
+
88
165
-**Functionality:** Packages should conceivably be useful to other users and
89
166
should expose their capabilities in a reasonable fashion.
167
+
90
168
-**Documentation:** Packages must contain a `README.md` file documenting (at
91
169
least briefly) what the package does and all definitions intended for usage by
92
170
downstream users. Examples in the README should show how to use the package
93
171
through an `@preview` import. If you have images in your README, you might
94
172
want to check whether they also work in dark mode. Also consider running
95
173
[`typos`][typos] through your package before release.
174
+
96
175
-**Style:** No specific code style is mandated, but two spaces of indent and
97
176
kebab-case for variable and function names are recommended.
177
+
98
178
-**License:** Packages must be licensed under the terms of an
99
179
[OSI-approved][OSI] license. In addition to specifying the license in the
100
180
TOML manifest, a package must either contain a `LICENSE` file or link to one
101
181
in its `README.md`.
182
+
183
+
*Additional details for template packages:* If you expect the package
184
+
license's provisions to apply to the contents of the template directory (used
185
+
to scaffold a project) after being modified through normal use, especially if
186
+
it still meets the _threshold of originality,_ you must ensure that users of
187
+
your template can use and distribute the modified contents without
188
+
restriction. In such cases, we recommend licensing at least the template
189
+
directory under a license that requires neither attribution nor distribution
190
+
of the license text. Such licenses include MIT-0 and Zero-Clause BSD. You can
191
+
use an SPDX AND expression to selectively apply different licenses to parts of
192
+
your package. In this case, the README or package files must make clear under
193
+
which license they fall. If you explain the license distinction in the README
194
+
file, you must not exclude it from the package.
195
+
102
196
-**Size:** Packages should not contain large files or a large number of files.
103
197
This will be judged on a case-by-case basis, but if it needs more than ten
104
198
files, it should be well-motivated. To keep the package small and fast to
105
199
download, please `exclude` images for the README or PDF files with
106
200
documentation from the bundle. Alternatively, you can link to images hosted on
107
201
a githubusercontent.com URL (just drag the image into an issue).
202
+
108
203
-**Security:** Packages must not attempt to exploit the compiler or packaging
109
204
implementation, in particular not to exfiltrate user data.
205
+
110
206
-**Safety:** Names and package contents must be safe for work.
111
207
112
208
This list may be extended over time as improvements/issues to the process are
@@ -121,20 +217,6 @@ There is one exception: Minor fixes to the documentation or TOML metadata of a
121
217
package are allowed _if_ they can not affect the package in a way that might
122
218
break downstream users.
123
219
124
-
### Templates
125
-
**Important:** Please do not submit templates as packages just yet. To make the
126
-
experience of using templates as seamless as possible, we want them to show up
127
-
in the web app's template gallery and we want the CLI to be able to scaffold a
128
-
project from a template. We ask for your patience while we're
129
-
[building][template-packages] the necessary infrastructure.
130
-
131
-
What's the difference between a template and a normal package? The line isn't
132
-
100% sharp, but overall a template will aid you in producing a full document
133
-
with a particular style, whereas normal packages provide building blocks and
134
-
automations useful across a range of documents. In particular, templates will
135
-
often ship with one or more template files from which a new project can be
136
-
scaffolded. This requires additional package metadata.
137
-
138
220
### Downloads
139
221
The Typst compiler downloads packages from the `preview` namespace on-demand.
140
222
Once used, they are cached in `{cache-dir}/typst/packages/preview` where
@@ -173,7 +255,9 @@ the Apache-2.0 license. Packages in `packages/` are licensed under their
0 commit comments