TemplaterApi
Templater’s internal API object, narrowed to the members this library calls.
Its members are snake_case because Templater’s are; they are transcribed rather than renamed so the shape can be checked against Templater’s source at a glance.
Import:
import type { TemplaterApi } from '@mnaoumov/obsidian-lib/templater';Signature:
export interface TemplaterApiProperties
| Property | Type | Description |
|---|---|---|
| create_running_config | (templateFile: TFile | undefined, targetFile: TFile, runMode: TemplaterRunMode) => TemplaterRunningConfig | Builds the TemplaterRunningConfig that describes one render. |
| current_functions_object? | object | undefined | The functions object (tp) of the render currently in flight, when there is one. |
| end_templater_task | (path: string) => Promise<void> | Closes the task TemplaterApi.start_templater_task opened. Once the last pending path is closed, Templater triggers templater:all-templates-executed, which is the ONLY thing that runs a template's tp.hooks.on_all_templates_executed(…) callbacks, so a caller must reach this even when the render throws. |
| functions_generator | TemplaterFunctionsGenerator | Builds the functions object (tp) a template is evaluated against. |
| overwrite_file_commands | (file: TFile, active_file?: boolean) => Promise<void> | Templater's own "render this note in place" entry point: it reads the file, renders it as a template and writes the result back, bracketed by its own task pair. |
| parse_template | (config: TemplaterRunningConfig, template_content: string) => Promise<string> | Renders the given template TEXT against a running config and returns the result.Templater reads the config's target_file eagerly while it builds the functions object, so a config without a real target file throws from inside Templater. |
| read_and_parse_template | (config: TemplaterRunningConfig) => Promise<string> | Reads the config's template_file and renders it, returning the resulting text. |
| start_templater_task | (path: string) => void | Registers a path as having a render in flight. Templater's own entry points bracket every render with this and TemplaterApi.end_templater_task; a render that skips the pair works, but never fires the tp.hooks callbacks. |
Links to this page: