@tola/module
读取已配置 Tola 模块的解析选项与静态资源。
导入
#import "@tola/module:0.0.0": *导出成员
get-module
let get-module(
name: str = "",
) = dictionary;返回指定模块实例的运行时信息(name、options、assets)。
即使多个别名指向同一份模块源码,每个别名也对应独立实例。
name:模块别名字符串。options:合并[modules.<alias>.options]站点覆盖后的选项字典。assets.files:用于读取模块资源文件的 Typstpath字典。assets.urls:模块资源的发布 URL 字典(已带site.base-path,开启 cache-busting 时带?h=<hash>)。
位置参数
namestr默认值:"":tola.toml中[modules.<alias>]声明的模块别名。仅在@tola-modules/*包内部调用时可省略,此时返回当前模块实例。
读取模块的样式表链接与标题选项
#import "@tola/module:0.0.0": get-module
#let theme = get-module("theme")
#html.link(rel: "stylesheet", href: theme.assets.urls.at("style.css"))
= #theme.options.title