Skip to content

v2.1: Support input flags and devShell tooling

Latest
Compare
Choose a tag to compare
@RossSmyth RossSmyth released this 27 May 19:14
· 21 commits to main since this release

Previously, when using a devShell, Tinymist would fail to find the packages and fonts that are used. This is because the fonts and packages are registered with environment variables in a wrapper. Now these are exposed with a shellHook, so the devShell should properly pick up these environment variables as well now.

Changes

  • Expose TYPST_PACKAGE_CACHE_PATH (Typst Universe dependencies), TYPST_PACKAGE_PATH (custom dependencies), and TYPST_FONT_PATHS (fonts) to the devShell
  • Support input arguments

Key-value arguments on the CLI provided with --input key=value
https://typst.app/docs/reference/foundations/sys/

buildTypstDocument {
    name = "inputs";
    src = ./.;
    inputs = {
      language = "en";
      name = "John Doe";
    };
  };
Value of "sys.inputs.language" is #sys.inputs.language

#if sys.inputs.name != "John Doe" {
  panic("Expected 'John Doe' in 'sys.inputs.name' but got " + sys.inputs.flag)
}

Huge shout-out to @jbgi for doing most of the legwork for both of these changes!