CtrlK
BlogDocsLog inGet started
Tessl Logo

pantheon-ai/obsidian-toolkit

Skills for working with Obsidian vaults and related formats: Obsidian Flavored Markdown, JSON Canvas files, the Obsidian CLI, and Defuddle for clean web content extraction.

96

Quality

96%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Advisory

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

FUNCTIONS_REFERENCE.mdobsidian-bases/references/

Functions Reference

Global Functions

FunctionSignatureDescription
date()date(string): dateParse string to date. Format: YYYY-MM-DD HH:mm:ss
duration()duration(string): durationParse duration string
now()now(): dateCurrent date and time
today()today(): dateCurrent date (time = 00:00:00)
if()if(condition, trueResult, falseResult?)Conditional
min()min(n1, n2, ...): numberSmallest number
max()max(n1, n2, ...): numberLargest number
number()number(any): numberConvert to number
link()link(path, display?): LinkCreate a link
list()list(element): ListWrap in list if not already
file()file(path): fileGet file object
image()image(path): imageCreate image for rendering
icon()icon(name): iconLucide icon by name
html()html(string): htmlRender as HTML
escapeHTML()escapeHTML(string): stringEscape HTML characters

Any Type Functions

FunctionSignatureDescription
isTruthy()any.isTruthy(): booleanCoerce to boolean
isType()any.isType(type): booleanCheck type
toString()any.toString(): stringConvert to string

Date Functions & Fields

Fields: date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond

FunctionSignatureDescription
date()date.date(): dateRemove time portion
format()date.format(string): stringFormat with Moment.js pattern
time()date.time(): stringGet time as string
relative()date.relative(): stringHuman-readable relative time
isEmpty()date.isEmpty(): booleanAlways false for dates

Duration Type

When subtracting two dates, the result is a Duration type (not a number). Duration has its own properties and methods.

Duration Fields:

FieldTypeDescription
duration.daysNumberTotal days in duration
duration.hoursNumberTotal hours in duration
duration.minutesNumberTotal minutes in duration
duration.secondsNumberTotal seconds in duration
duration.millisecondsNumberTotal milliseconds in duration

IMPORTANT: Duration does NOT support .round(), .floor(), .ceil() directly. You must access a numeric field first (like .days), then apply number functions.

# CORRECT: Calculate days between dates
"(date(due_date) - today()).days"                    # Returns number of days
"(now() - file.ctime).days"                          # Days since created

# CORRECT: Round the numeric result if needed
"(date(due_date) - today()).days.round(0)"           # Rounded days
"(now() - file.ctime).hours.round(0)"                # Rounded hours

# WRONG - will cause error:
# "((date(due) - today()) / 86400000).round(0)"      # Duration doesn't support division then round

Date Arithmetic

# Duration units: y/year/years, M/month/months, d/day/days,
#                 w/week/weeks, h/hour/hours, m/minute/minutes, s/second/seconds

# Add/subtract durations
"date + \"1M\""           # Add 1 month
"date - \"2h\""           # Subtract 2 hours
"now() + \"1 day\""       # Tomorrow
"today() + \"7d\""        # A week from today

# Subtract dates returns Duration type
"now() - file.ctime"                    # Returns Duration
"(now() - file.ctime).days"             # Get days as number
"(now() - file.ctime).hours"            # Get hours as number

# Complex duration arithmetic
"now() + (duration('1d') * 2)"

String Functions

Field: string.length

FunctionSignatureDescription
contains()string.contains(value): booleanCheck substring
containsAll()string.containsAll(...values): booleanAll substrings present
containsAny()string.containsAny(...values): booleanAny substring present
startsWith()string.startsWith(query): booleanStarts with query
endsWith()string.endsWith(query): booleanEnds with query
isEmpty()string.isEmpty(): booleanEmpty or not present
lower()string.lower(): stringTo lowercase
title()string.title(): stringTo Title Case
trim()string.trim(): stringRemove whitespace
replace()string.replace(pattern, replacement): stringReplace pattern
repeat()string.repeat(count): stringRepeat string
reverse()string.reverse(): stringReverse string
slice()string.slice(start, end?): stringSubstring
split()string.split(separator, n?): listSplit to list

Number Functions

FunctionSignatureDescription
abs()number.abs(): numberAbsolute value
ceil()number.ceil(): numberRound up
floor()number.floor(): numberRound down
round()number.round(digits?): numberRound to digits
toFixed()number.toFixed(precision): stringFixed-point notation
isEmpty()number.isEmpty(): booleanNot present

List Functions

Field: list.length

FunctionSignatureDescription
contains()list.contains(value): booleanElement exists
containsAll()list.containsAll(...values): booleanAll elements exist
containsAny()list.containsAny(...values): booleanAny element exists
filter()list.filter(expression): listFilter by condition (uses value, index)
map()list.map(expression): listTransform elements (uses value, index)
reduce()list.reduce(expression, initial): anyReduce to single value (uses value, index, acc)
flat()list.flat(): listFlatten nested lists
join()list.join(separator): stringJoin to string
reverse()list.reverse(): listReverse order
slice()list.slice(start, end?): listSublist
sort()list.sort(): listSort ascending
unique()list.unique(): listRemove duplicates
isEmpty()list.isEmpty(): booleanNo elements

File Functions

FunctionSignatureDescription
asLink()file.asLink(display?): LinkConvert to link
hasLink()file.hasLink(otherFile): booleanHas link to file
hasTag()file.hasTag(...tags): booleanHas any of the tags
hasProperty()file.hasProperty(name): booleanHas property
inFolder()file.inFolder(folder): booleanIn folder or subfolder

Link Functions

FunctionSignatureDescription
asFile()link.asFile(): fileGet file object
linksTo()link.linksTo(file): booleanLinks to file

Object Functions

FunctionSignatureDescription
isEmpty()object.isEmpty(): booleanNo properties
keys()object.keys(): listList of keys
values()object.values(): listList of values

Regular Expression Functions

FunctionSignatureDescription
matches()regexp.matches(string): booleanTest if matches

tile.json