A template to create awesome short writings to share in social media thanks to Typst simple yet powerful syntax.
share.typ is intended to be used by importing share.typ file from a "content" file
(example.typ as example). This content file is used to call the functions which
apply document style & show post components and load post data from a YAML file
(example.yml as example). Inside the content file you can modify several style
variables and even override existing function implementations to your heart's content.
With Typst CLI (Recommended)
The recommended usage with Typst CLI is by adding this share.typ repository as a git
submodule. This way, upstream changes can be
pulled easily.
<your-post-repo>/
├── share.typ/ // git submodule
| └── share.typ
├── post/ // post YAML directory
| ├── 01-post-one.yml
| ├── 02-post-two.yml
| └── ...
└── <your-post-content>.typ // #import "share.typ/share.typ": *
- Add mangkoran/share.typ as git submodule into your repo.
git submodule add https://github.com/mangkoran/share.typ
- Copy and rename
example.typandexample.ymlto your repo root directory. For post YAML file you can create a new directory (postor else) for better organization. Don't forget to update the YAML import to reflect this. Use these files as template/starting point for your post. - Compile content file. Typst compiles to PDF by default. To compile Typst to PNG, use the following command.
typst compile <your-post-content>.typ <output>.png
# or you can use `watch` command to auto recompile on change
# (a bit buggy tho especially with vi/vim/nvim)
typst watch <your-post-content>.typ <output>.pngWith typst.app
- Upload the
share.typ,example.typandexample.ymlfiles to your Typst project. You may renameexample.typandexample.yml. For post YAML file you can create a new directory (postor else) for better organization. Don't forget to update the YAML import to reflect this. - Use
example.typandexample.yml(or whatever the names after you rename it) as template/starting point for your post.
