I finally decided to try the package the system with my home cooked templates.
One of the templates takes the path to an image as an argument. My problem is that all paths seems to be relative to the package folder rather than the .typ file to compile.
Is it possible to :
Supply a path relative to the path of the file to compile, or failing that,
Packages cannot access project files, unless the package is installed inside of the project
If you want to pass an image to your template, you will have to read it in your project and pass the image object to the template
In Typst 0.15.0 the path type was added. It is resolved relative to where it is called (e.g. user code) and can also be passed to packages, allowing them to read the file.
Your package could therefore take a path for the image. Or for convenience it could support both path and content (assuming the content represents an image(...)), and then check type(...) to determine how to handle it:
let img-type = type(img)
if img-type == content {
// show as-is, assuming it is already an image
img
} else if img-type == path {
image(img)
} else {
panic("unsupported img type: " + str(img-type))
}
Users can then either provide a path(...) and your package decides how to display the image, or for more advanced use cases users can directly provide an image(...) and customize it as they like.