Migrating to Typsite 0.1.6
Migrating to Typsite 0.1.6
In version 0.1.6, Typsite introduced a series of major updates, inevitably including some breaking-changes. This document aims to help users migrate to the new version smoothly.
1 Typsite Packages
Parts of the Typst library that are closely related to Typsite have been extracted into separate Typst packages. You can find them under typsite/packages. Typsite bundles these packages into the binary and automatically installs them to the
@local
@local
directory during each
typsite compile
typsite compile
.
To facilitate debugging and using packages, Typsite also supports local package auto-installation. Just specify the
--packages
--packages
flag when running
typsite compile
typsite compile
.
- In
watch-modewatch-mode, Typsite will also automatically update these local packages and recompile the site.
So now, the Typsite Typst libraries are split into two parts:
@local/typsite:0.1.0@local/typsite:0.1.0: Contains core functionality of Typsite, provides basic functions, and acts as an interface between Typsite and site libraries.- Thanks to this layer, it is unlikely for future updates to introduce more breaking-changes.
-
root/lib/root/lib/: The site library of each Typsite site. Users are free to customize anything here.
2 Migration
If you’re relying on site libraries from before version 0.1.6, you’ll need to make the following replacements when migrating:
-
import "lib.typ"import "lib.typ"|->import "/lib/lib.typ"import "/lib/lib.typ" -
html-texthtml-text|->html.texthtml.text text-aligntext-align|->html.alignhtml.align- (Make sure not- to replace
text-aligntext-aligninside/lib/site.typ/lib/site.typ)
- (Make sure not- to replace
It’s recommended to import
lib.typ
lib.typ
using an absolute path. If you’re using tinymist as your LSP, you’ll need to specify the Typst
root-path
root-path
for better experience:
In VSCode, you can add the following to
.vscode/settings.json.vscode/settings.jsonin your site directory:"tinymist.rootPath": "absolute path of your site/root""tinymist.rootPath": "absolute path of your site/root"
For any breaking-changes not anticipated here, you can easily detect them by launching
watch-mode
watch-mode
with
typsite compile --port 8000
typsite compile --port 8000
. Typsite will provide helpful error messages whenever you modify a file, allowing you to fix issues quickly.
3 Other Updates
Added support for converting Typst math to MathML.
- This improves the rendering of math formulas, and the MathML conversion will detect Typst math fonts in-place for compatibility.
-
inlineinlinefunction has a newfit-fontfit-fontparameter, which can adapt to Typst’scontext text.sizecontext text.size. - For pages containing backlinks and references, duplicate tags in the
<head><head>section are now removed, resulting in a much cleaner structure. - In the default site library,
show-rulesshow-ruleshave been modularized. You can easily add/remove/modifyshow-ruleshow-ruleitems in/lib/lib.typ/lib/lib.typ. - In the default site configuration, link titles have been optimized. You can now preview links as
Link Title [Link URL]Link Title [Link URL].