Introspection functions for the AshTypst.Resource extension.
Use these functions to programmatically inspect the templates, render entities,
and configuration options declared in a resource's typst DSL section.
For the full DSL reference, see AshTypst.Resource.
Summary
Functions
Returns all render entities declared in the typst section.
Looks up a template by name. Returns {:ok, template} or :error.
Looks up a template by name. Raises if not found.
Returns all templates declared in the typst section.
typst DSL entities
Additional font search directories.
Additional font search directories.
Skip system font loading.
Skip system font loading.
typst DSL options
Root directory for template file resolution.
Root directory for template file resolution.
Functions
@spec renders(Spark.Dsl.t() | module()) :: [AshTypst.Resource.Render.t()]
Returns all render entities declared in the typst section.
@spec template(Spark.Dsl.t() | module(), atom()) :: {:ok, AshTypst.Resource.Template.t()} | :error
Looks up a template by name. Returns {:ok, template} or :error.
@spec template!(Spark.Dsl.t() | module(), atom()) :: AshTypst.Resource.Template.t()
Looks up a template by name. Raises if not found.
@spec templates(Spark.Dsl.t() | module()) :: [AshTypst.Resource.Template.t()]
Returns all templates declared in the typst section.
typst DSL entities
@spec typst_font_paths(dsl_or_extended :: module() | map()) :: {:ok, [String.t() | {atom(), String.t()}]} | :error
Additional font search directories.
Each entry may be a string (used verbatim) or a
{otp_app, sub_path} tuple (resolved via
Application.app_dir/2 at runtime). Mix releases relocate
priv/ files, so the tuple form is recommended for paths
rooted in your app's priv/.
@spec typst_font_paths!(dsl_or_extended :: module() | map()) :: [String.t() | {atom(), String.t()}] | no_return()
Additional font search directories.
Each entry may be a string (used verbatim) or a
{otp_app, sub_path} tuple (resolved via
Application.app_dir/2 at runtime). Mix releases relocate
priv/ files, so the tuple form is recommended for paths
rooted in your app's priv/.
Skip system font loading.
Skip system font loading.
typst DSL options
Returns a map containing the and any configured or default values.
@spec typst_root(dsl_or_extended :: module() | map()) :: {:ok, String.t() | {atom(), String.t()}} | :error
Root directory for template file resolution.
Accepts either:
- a
String.t()— used verbatim. Relative paths resolve against the current working directory and only work when cwd matches the project root (dev/test). - a
{otp_app, sub_path}tuple — resolved at runtime viaApplication.app_dir/2, which works in dev, test, and Mix releases (wherepriv/lives at<release>/lib/<app>-<version>/priv/...).
For releases-friendly setups, prefer the tuple form:
root({:my_app, "priv/typst"})
@spec typst_root!(dsl_or_extended :: module() | map()) :: (String.t() | {atom(), String.t()}) | no_return()
Root directory for template file resolution.
Accepts either:
- a
String.t()— used verbatim. Relative paths resolve against the current working directory and only work when cwd matches the project root (dev/test). - a
{otp_app, sub_path}tuple — resolved at runtime viaApplication.app_dir/2, which works in dev, test, and Mix releases (wherepriv/lives at<release>/lib/<app>-<version>/priv/...).
For releases-friendly setups, prefer the tuple form:
root({:my_app, "priv/typst"})