#typst #package

typst-embedded-package

Support to embed typst package to the binary

1 unstable release

new 0.2.0 Jan 9, 2025
0.1.0 Jan 9, 2025

#349 in Embedded development

Download history 198/week @ 2025-01-05

198 downloads per month

MIT/Apache

91KB
117 lines

Typst-Embedded-Package

Embed typst packages directly in the binary.

How to use

  1. Download package archives from https://typst.app/universe/search/?kind=packages
  2. Move those archives somewhere in the src directory
  3. Include the archives with include_package!
  4. Read the content of the archive with Package::read_archive (requires the read-archive feature)
// Embed the package located at "/src/typst-packages/preview/cetz-0.3.1.tar.gz"
const CETZ: Package = include_package!("typst-packages" "preview" "cetz" (0, 3, 1));

// Embed multiple packages.
const PACKAGES: [Package; 2] = include_package!(
    "typst-packages"
    [
        "preview" "cetz" (0, 3, 1),
        "preview" "oxifmt" (0, 2, 0),
    ]
);

lib.rs:

Embed typst packages directly in the binary.

How to use

  1. Download package archives from https://typst.app/universe/search/?kind=packages
  2. Move those archives somewhere in the src directory
  3. Include the archives with include_package!
  4. Read the content of the archive with Package::read_archive (requires the read-archive feature)
# use typst_embedded_package::{include_package, Package};
// Embed the package located at "/src/typst-packages/preview/cetz-0.3.1.tar.gz"
const CETZ: Package = include_package!("typst-packages" "preview" "cetz" (0, 3, 1));

// Embed multiple packages.
const PACKAGES: [Package; 2] = include_package!(
    "typst-packages"
    [
        "preview" "cetz" (0, 3, 1),
        "preview" "oxifmt" (0, 2, 0),
    ]
);

Dependencies

~60MB
~860K SLoC