Migrating to Typsite 0.1.7

In version 0.1.7, Typsite introduced a series of major updates about SVG-compat, inevitably including some breaking-changes. This document aims to help users migrate to the new version smoothly.

1 0.1.6 Migration

Make sure you’ve done: Migrating to Typsite 0.1.6

2 .typsite Configuration Migration

In version 0.1.7, the following new components and rewrites were added to the .typsite directory:

  • .typsite/components/anchor_def_svg.html .typsite/components/anchor_def_svg.html : SVG anchor definition component
  • .typsite/components/anchor_goto_svg.html .typsite/components/anchor_goto_svg.html : SVG anchor goto component
  • .typsite/rewrite/footnote-ref-svg.html .typsite/rewrite/footnote-ref-svg.html : Footnote reference rewrite for SVG

If you’re upgrading from an older version, make sure to copy these new files to your site’s .typsite directory.

3 /root/lib Library Migration
3.1 inline Function Signature Change

The fit-font fit-font parameter semantics of the inline inline function have changed:

  • Before 0.1.7: fit-font fit-font was a bool bool type
  • After 0.1.7: fit-font fit-font is a 1em 1em type (can be true true , false false , or values like 1em 1em , 2em 2em )

Migration:

  • inline(content, fit-font: true) inline(content, fit-font: true) |-> inline(content, fit-font: 1em) inline(content, fit-font: 1em)
  • inline(content, fit-font: false) inline(content, fit-font: false) |-> inline(content) inline(content) or inline(content, fit-font: false) inline(content, fit-font: false)
3.2 Library Import Changes

If you’ve customized the inline inline function in your site library, you need to update the call signature:

// Old version
#import "@local/typsite:0.1.0": inline

// New version
#let footnotes = state("footnotes", ())
#let inline(..args) = context {
  import "@local/typsite:0.1.0": inline
  inline(..args, footnotes: footnotes.get())
}
// Old version
#import "@local/typsite:0.1.0": inline

// New version
#let footnotes = state("footnotes", ())
#let inline(..args) = context {
  import "@local/typsite:0.1.0": inline
  inline(..args, footnotes: footnotes.get())
}
3.3 rule Function Signature Changes

The following functions in rule.typ rule.typ now need to receive the footnotes footnotes parameter:

  • rule-ref(footnotes) rule-ref(footnotes) instead of the old rule-ref rule-ref
  • rule-footnote(footnotes) rule-footnote(footnotes) instead of the old rule-footnote rule-footnote

In the schema schema function, you need to fetch footnotes first and then pass them to the rules:

let _footnotes = query(footnote).map(it => it.at("label", default: none)).filter(it => it != none)
show: rule-footnote(_footnotes)
show: rule-ref(_footnotes)
let _footnotes = query(footnote).map(it => it.at("label", default: none)).filter(it => it != none)
show: rule-footnote(_footnotes)
show: rule-ref(_footnotes)
4 /packages Package Migration
4.1 inline Function New footnotes Parameter

The inline inline function in @local/typsite:0.1.0 @local/typsite:0.1.0 now requires a footnotes footnotes parameter:

// Old version
inline(content, fit-font: true, scale: 100%)

// New version
inline(content, fit-font: 1em, scale: 100%, footnotes: ())
// Old version
inline(content, fit-font: true, scale: 100%)

// New version
inline(content, fit-font: 1em, scale: 100%, footnotes: ())
4.2 auto-sized-svg New fit-font Parameter

The auto-sized-svg auto-sized-svg function now has a fit-font fit-font parameter with more flexible font size control:

  • true true : Use CSS font-size inheritance
  • false false : Use fixed font-size: 1rem
  • 1em 1em : Use relative em value
5 Zed Editor Compatibility
5.1 Zed LSP Configuration

If you’re using Zed as your editor, you can add the following configuration for a better Typst development experience:

Add to .zed/settings.json .zed/settings.json :

{
  "lsp": {
    "tinymist": {
      "initialization_options": {
        "exportPdf": "never",
        "rootPath": "your/site/root/path",
      },
    },
  },
}
{
  "lsp": {
    "tinymist": {
      "initialization_options": {
        "exportPdf": "never",
        "rootPath": "your/site/root/path",
      },
    },
  },
}
5.2 VSCode Settings Migration

If you were previously using VSCode with tinymist configured, you need to update rootPath rootPath to an absolute path:

In .vscode/settings.json .vscode/settings.json :

{
  "tinymist.rootPath": "/absolute/path/to/your/site/root"
}
{
  "tinymist.rootPath": "/absolute/path/to/your/site/root"
}
6 0.1.6 Migration Link

If you’re migrating from version 0.1.6 , make sure you’ve also completed the 0.1.6 migration steps:

  • import "lib.typ" import "lib.typ" |-> import "/lib/lib.typ" import "/lib/lib.typ"
  • html-text html-text |-> html.text html.text
  • text-align text-align |-> html.align html.align
7 Other Updates
  • Added SVG anchor support, allowing creation of jumpable anchors in Typst content
  • Footnote references now support SVG inline rendering
  • Improved the font size adaptation mechanism for the inline inline function
  • Added support for more flexible fit-font fit-font parameter, allowing specific em values