用途:该技能让兼容的代理创建和编辑 Obsidian Templater 模板,处理 .md 文件中的动态内容、模板变量与函数。
主要能力:支持模板语法 <% %>、执行块 <%* %>,以及 tp.file、tp.system、tp.date、tp.frontmatter、tp.config、tp.hooks、tp.static 等对象。可做用户输入(tp.system.prompt、suggester、multi_suggester)、日期格式化、文件创建(tp.file.create_new)、frontmatter 只读访问与通过 app.fileManager.processFrontMatter 修改、HTTP 请求与用户脚本(tp.user)。
用法要点:输入用 await tp.system.prompt(...);下拉用 tp.system.suggester/ multi_suggester;日期用 tp.date.now('YYYY-MM-DD', offset, date);创建文件为 tp.file.create_new(template, filename?, open_new?, folder?),返回 Promise<TFile>;frontmatter 只读,修改需配合 tp.hooks 与 processFrontMatter。复杂逻辑建议用 tR += 累加。
版本提示:文档基于 Templater v2.18.1+,v1→v2 存在参数顺序、API 签名等 breaking changes,例如 create_new 参数顺序变化、prompt 移除 title、旧 tp.file.create() 已移除;使用前需核对插件版本并备份 vault。
限制:Templater 可执行任意 JavaScript,存在安全风险,系统命令与 HTTP 请求在移动端/沙盒中受限,v2.x 默认开启“Only run trusted templates”;不应使用来源不可信的模板。文档未提供收费价格信息。