Skip to content

Commit e30ad86

Browse files
committed
docs: improve docs for writing documentation and what files to exclude
1 parent 3a816dd commit e30ad86

File tree

3 files changed

+49
-30
lines changed

3 files changed

+49
-30
lines changed

docs/documentation.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,25 @@ Examples in the README should show how to use the package through a `@preview`
66
import. Also consider running [`typos`][typos] through your package before
77
release.
88

9-
More complete documentation (usually written in Markdown, or in a PDF
10-
generated from a Typst file) can be linked from this README.
9+
More complete documentation (usually written in Markdown, or in a PDF generated
10+
from a Typst file) can be linked from this README. In general there are two
11+
options for linking these resources:
12+
13+
If the resources are committed to this repository, you should link them locally.
14+
For example like this: `[manual.pdf](docs/manual.pdf)`. Most of these files
15+
should be excluded in your [manifest], see [what to exclude].
16+
17+
If the resources are stored elsewhere, you can link to their URL as usual. When
18+
linking to files from another git repository, consider linking to a specific tag
19+
or revision, instead of the `main` branch. This will ensure that the linked
20+
resources always match the version of the package. So for example, prefer linking
21+
to the first URL instead of the second one:
22+
1. `https://github.com/micheledusi/Deckz/blob/v0.3.0/docs/manual-deckz.pdf`
23+
2. `https://github.com/micheledusi/Deckz/blob/main/docs/manual-deckz.pdf`
1124

1225
If your package has a dedicated documentation website, it can be linked in the
1326
README, but also via the `homepage` field of your [manifest].
1427

15-
When linking to a manual, images, etc. from another git repository, consider
16-
linking to a specific tag or revision, instead of the `main` branch. This will
17-
ensure that the linked resources always match the version of the package.
18-
1928
## Differences from standard Markdown
2029

2130
Typst Universe processes your package README before displaying it,
@@ -44,5 +53,6 @@ using the following snippet:
4453

4554
[typos]: https://github.com/crate-ci/typos
4655
[manifest]: manifest.md
56+
[what to exclude]: tips.md#what-to-commit-what-to-exclude
4757
[alert blocks]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
4858
[emoji shortcodes]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#using-emojis

docs/manifest.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ Optional:
6666
- `compiler`: The minimum Typst compiler version required for this package to
6767
work.
6868
- `exclude`: An array of globs specifying files that should not be part of the
69-
published bundle that the compiler downloads when importing the package. To be
70-
used for large support files like images or PDF documentation that would
69+
published bundle that the compiler downloads when importing the package. These
70+
files will still be available on typst universe to link to from the README.\
71+
To be used for large support files like images or PDF documentation that would
7172
otherwise unnecessarily increase the bundle size. Don't exclude the README or
72-
the LICENSE.
73+
the LICENSE, see [what to exclude].
7374

7475
Packages always live in folders named as `{name}/{version}`. The name and
7576
version in the folder name and manifest must match. Paths in a package are local
@@ -219,4 +220,5 @@ foo = "bar"
219220
[SemVer]: https://semver.org/
220221
[oxipng]: https://github.com/shssoichiro/oxipng
221222
[license]: licensing.md
222-
[description]: #writing-a-good-description
223+
[description]: #writing-a-good-description
224+
[what to exclude]: tips.md#what-to-commit-what-to-exclude

docs/tips.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,36 @@ larger than they need to be.
3737

3838
There are two solutions to limit this problem: excluding files from the archive
3939
(using the `exclude` key in your [package manifest][manifest]), or simply not
40-
commiting the files to this repository in the first place.
40+
committing the files to this repository in the first place.
4141

4242
To know which strategy to apply to each file, we can split them in three groups:
4343

44-
- Files that are necessary for the package to work. If any of these files are
45-
removed, the package would break for the end user. This includes the manifest
46-
file, main Typst file and its dependencies, and in case of a template package,
47-
any file in the template directory.
48-
- Files that are necessary for the package to be displayed correctly on Typst
49-
Universe. This includes the README, and any files that are linked from there
50-
(manuals, examples, illustrations, etc.). These files can easily be accessed
51-
by opening the package README.
52-
- Other files. This generally includes test files, build scripts, but also
53-
examples or manuals that are not linked in the README. These files would be
54-
almost impossible to access for the final user, unless they browse this GitHub
55-
repository or their local package cache.
56-
57-
The first two groups should be commited to this repository, but files that are
58-
not strictly necessary for the package to work (the second group) should be
59-
excluded in `typst.toml`. The third group should simply not be copied here, or
60-
you should consider linking them from your README so that they are easily
61-
discoverable. A good example showing how to link examples and a manual is
62-
[CeTZ][cetz].
44+
__1. Required files__\
45+
Files that are necessary for the package to work. If any of these files are
46+
removed, the package would break for the end user. This includes the manifest
47+
file, main Typst file and its dependencies, and in case of a template package,
48+
any file in the template directory.
49+
50+
__2. Documentation files__\
51+
Files that are necessary for the package to be displayed correctly on Typst
52+
Universe. This includes the README, and any files that are linked from there
53+
(manuals, examples, illustrations, etc.). These files can easily be accessed
54+
by opening the package README.
55+
56+
__3. Other files__\
57+
This generally includes test files, build scripts, but also examples or manuals
58+
that are not linked in the README. These files would be almost impossible to
59+
access for the final user, unless they browse this GitHub repository or their
60+
local package cache.
61+
62+
The first two groups (required and documentation files) should be committed to
63+
this repository. And files that are not strictly necessary for the package to
64+
work (documentation files) should be excluded in `typst.toml`. They will still
65+
be available on typst universe to link to from the README.\
66+
The third group should simply not be committed to this repository. If you think
67+
some of the remaining files are important, they probably belong to the second
68+
group and should be linked in the README, so that they are easily discoverable.
69+
A good example showing how to link examples and a manual is [CeTZ][cetz].
6370

6471
The only exceptions to this rule are the LICENSE file (that should always be
6572
available along with the source code, so it should not be excluded), and the

0 commit comments

Comments
 (0)