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.load
The user should still be able to pass a path, which is useful in the (rare) case described above
The schema.load function could be adapted to allow passing the file content (via read) and the format (i.e. yaml, json, etc.)
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.load`
The user should still be able to pass a path, which is useful in the (rare) case described above
The `schema.load` function could be adapted to allow passing the file content (via `read`) and the format (i.e. `yaml`, `json`, etc.)
HEL
added the enhancement label 2024-10-28 11:53:00 +00:00
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 Typst
Another solution (even less practical) is to include the package in your project
EDIT: You can actually also directly call the yaml or json functions and pass the result:
The current workaround is to read the file into a raw block and passing that to `schema.load`:
```typst
#let data = raw(read("schema.yaml"), block: true, lang: "yaml")
#let example = schema.load(data)
#schema.render(example)
```
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 Typst
Another solution (even less practical) is to include the package in your project
EDIT: You can actually also directly call the `yaml` or `json` functions and pass the result:
```typst
#let data = yaml("schema.yaml")
#let example = schema.load(data)
#schema.render(example)
```
#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
#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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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