hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: f0a6fcfbf87a7630faba919894272765ae0a0a3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# mktypst

just a couple of dumb typst templates so i stop rewriting the same document setup every fucking time.

```sh
$ mktypst rapport
$ typst watch rapport.typ
```

## templates
`paper` is a two-column academic article; `letter` is a french formal letter. both are french by default (`lang: "fr"`), so you get guillemets, the spacing before `; : ! ?`, `Résumé`, `Tableau`, all of it — pass `lang: "en"` for english.

you apply one with a `#show` rule at the top of the document and start writing:

```typ
#import "@local/hachem:0.1.0": paper

#show: paper.with(
  title: "Les Origines de YHWH",
  date: "mars 2026",
  authors: ((name: "Hachem H.", location: [Paris, France]),),
  abstract: [Un paragraphe.],
)

= Introduction
Du texte.
```

the `letter` works the same way. there are full examples in `samples/`, and `make samples` compiles them.

## usage

```text
$ mktypst --help
mktypst 0.1.0 - dumb typst document generator

generates a typst document that imports and applies an mktypst
template, so you can start writing instead of pasting a preamble.

usage: mktypst [-t template] [-T title] [-a author] [-d date] [-f] <name>
       mktypst [-v | -h]

options:
  -t, --template NAME  template to apply (default paper)
  -T, --title TITLE    document title (default: the name)
  -a, --author NAME    author name (default: git config user.name)
  -d, --date DATE      document date (default: current month)
  -f, --force          overwrite an existing file
      --stdout         write to stdout instead of a .typ file
  -v, --version        print version and bail
  -h, --help           print this and bail

by hachem <im@hachem.wtf>
```

```sh
$ mktypst rapport                       # paper, the default
$ mktypst -t letter -T "candidature" x  # a letter instead
$ mktypst --stdout note                 # print it, don't write a file
```

## install

```sh
$ git clone https://git.hachem.wtf/mktypst && cd mktypst
$ sudo make install            # mktypst -> /usr/local/bin, templates -> @local/hachem
$ make install PREFIX=~/.local # or without sudo
```

you need a c compiler for the binary, and typst (plus the eb garamond font) to build documents. the templates install into typst's local package dir, so any file can `#import "@local/hachem:0.1.0"`. in the typst app, link that folder as the namespace `local` and it works there too.

## license

`mktypst` is licensed under the mit license. see [license](LICENSE) for more.