Quick Reference

Example Template

---
creation date: 2021-07-22 16:44
modification date: Thursday 29th July 2021 07:11:19
---

<< [[2021-08-10]] | [[2021-08-12]] >>

# Templater Obsidian plugin

> It is easy to sit up and take notice, What is difficult is getting up and taking action.
> &mdash; <cite>Honore de Balzac</cite>

Will produce the following result when inserted:

---
creation date: 2021-01-07 17:20
modification date: Thursday 7th January 2021 17:20:43
---

<< [[2021-04-08]] | [[2021-04-10]] >>

# Test Test

> Do the best you can until you know better. Then when you know better, do better.
> &mdash; <cite>Maya Angelou</cite>

Date Module

Internal Variable / FunctionArgumentsDescriptionExample Output
tp.date.now(format: string = "YYYY-MM-DD", offset?: number⎮string, reference?: string, reference_format?: string)
  • format: Format for the date, refer to format reference
  • offset: Offset for the day, e.g. set this to -7 to get last week’s date. You can also specify the offset as a string using the ISO 8601 format, e.g. set this to “P-1M” to get last month’s date.
  • reference: The date referential, e.g. set this to the note’s title
  • reference_format: The date reference format.
Retrieves the date.2021-01-15
tp.date.tomorrow(format: string = "YYYY-MM-DD")
  • format: Format for the date, refer to format reference
Retrieves tomorrow’s date2020-11-07
tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)
  • format: Format for the date, refer to format reference
  • weekday: Week day number. If the locale assigns Monday as the first day of the week, 0 will be Monday, -7 will be last week’s day.
  • reference: The date referential, e.g. set this to the note’s title
  • reference_format: The date reference format.
Retrieves the week’s day date.2021-04-06
tp.date.yesterday(format: string = "YYYY-MM-DD")
  • format: Format for the date, refer to format reference
Retrieves yesterday’s date2020-11-07

System Module

Internal Variable / FunctionArgumentsDescriptionExample Output
tp.system.clipboard()NoneRetrieves the clipboard’s contentThis is my copied text
tp.system.prompt(prompt_text?: string, default_value?: string, throw_on_cancel: boolean = false)
  • prompt_text: Text placed above the input field
  • default_value: A default value for the input filed
  • throw_on_cancel: Throws an error if the prompt is canceled, instead of returning a null value.
Spawns a prompt modal and returns the user’s input.A value I entered
tp.system.suggester(text_items: string[] ⎮ ((item: T) => string), items: T[], throw_on_cancel: boolean = false, placeholder: string = "")
  • text_items: Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation.
  • items: Array containing the values of each item in the correct order.
  • throw_on_cancel: Throws an error if the suggester prompt is canceled, instead of returning a null value.
  • placeholder: Placeholder string of the prompt.
Spawns a suggester prompt and returns the user’s chosen item.A value I chose

Links