Project files are not accessible from within package #3
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As of Typst 0.12, a package cannot access project files (e.g. with
read,yaml, etc.) unless it is included in the project itself.The manual should warn the user of this behavior in the documentation for
schema.loadThe user should still be able to pass a path, which is useful in the (rare) case described above
The
schema.loadfunction could be adapted to allow passing the file content (viaread) and the format (i.e.yaml,json, etc.)Stumbled into this while trying to render an example. How do I specify the file to render?
The current workaround is to read the file into a raw block and passing that to
schema.load:This is really not ideal an I will probably integrate it directly into
schema.load, except if a mechanism to read files outside of the package is added to TypstAnother solution (even less practical) is to include the package in your project
EDIT: You can actually also directly call the
yamlorjsonfunctions and pass the result:#6 adds a new chapter in the manual explaining the various ways to load a schema, highlighting that the package cannot access project files unless it is itself included inside the project