### Folder Template Examples
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/features/template-variables.md
Examples of organizing tasks into folder hierarchies using project, status, and date variables.
```text
Tasks/{{project}}/{{status}}
```
```text
Daily/{{year}}/{{month}}/{{day}}
```
```text
Events/{{year}}/{{icsEventTitleKebab}}
```
--------------------------------
### Install mdbase-tasknotes CLI
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/mdbase-tasknotes-cli.md
Install the mdbase-tasknotes CLI globally using npm.
```bash
npm install -g mdbase-tasknotes
```
--------------------------------
### Filename Template Examples
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/features/template-variables.md
Examples of generating filenames using Zettelkasten IDs or timestamps.
```text
{{zettel}}-{{titleKebab}}
```
```text
{{shortDate}}-{{title}}
```
--------------------------------
### Start a timer
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/mdbase-tasknotes-cli.md
Starts a timer for a given task. Optionally, a description can be provided.
```bash
mtn timer start "Write report"
```
```bash
mtn timer start "Write report" -d "Drafting introduction"
```
--------------------------------
### Install i18n-state-manager
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/development/i18n-state-manager.md
Install the i18n-state-manager package as a development dependency using npm.
```bash
npm install -D i18n-state-manager
```
--------------------------------
### Start Pomodoro Session
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Starts a new Pomodoro session. Optionally accepts a taskId and duration.
```bash
POST /api/pomodoro/start
```
--------------------------------
### Install ripgrep for i18n commands
Source: https://github.com/callumalpass/tasknotes/blob/main/I18N_GUIDE.md
Instructions for installing ripgrep, a dependency for `i18n:check-usage` and `i18n:find-unused` commands.
```bash
# macOS
brew install ripgrep
# Ubuntu/Debian
apt install ripgrep
# Arch Linux
pacman -S ripgrep
# Windows
choco install ripgrep
```
--------------------------------
### Example Test Structure for View Components
Source: https://github.com/callumalpass/tasknotes/blob/main/tests/coverage-report.md
This example illustrates the directory structure and file naming conventions for implementing unit tests for view components in the TaskNotes Obsidian plugin.
```typescript
tests/unit/views/
├── TaskListView.test.ts
├── CalendarView.test.ts
├── KanbanView.test.ts
└── TimelineView.test.ts
```
--------------------------------
### Example Automation Listener
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/javascript-api.md
This example demonstrates how to register an event listener for `task.status.changed` and conditionally trigger another API method (`api.time.start`) based on the event's payload and context.
```APIDOC
Example automation-style listener:
```javascript
const source = "my-workflow-plugin";
this.registerEvent(
api.events.on("task.status.changed", async (event) => {
if (event.source === source) {
return;
}
if (event.after?.status !== "active") {
return;
}
await api.time.start(event.after.path, undefined, {
source,
correlationId: event.correlationId ?? crypto.randomUUID(),
reason: "status changed to active",
});
})
);
```
```
--------------------------------
### Example task frontmatter
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/getting-started/existing-vault.md
A representative example of frontmatter using canonical values without natural-language trigger characters.
```yaml
---
type: task
status: open
contexts:
- office
tags:
- review
---
```
--------------------------------
### Get OpenAPI UI Docs
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Returns the Swagger UI for visualizing the OpenAPI documentation.
```bash
GET /api/docs/ui
```
--------------------------------
### Project Suggestion Display Format
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/features/task-management.md
Example output format for project suggestions when typing the '+' trigger character.
```text
project-alpha [title: Alpha Project Development | aliases: alpha, proj-alpha]
meeting-notes [title: Weekly Team Meeting Notes]
simple-project
work-file [aliases: work, office-tasks]
```
--------------------------------
### Get Calendars Overview
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Returns an overview of provider connectivity and subscription counts for calendars.
```bash
GET /api/calendars
```
--------------------------------
### Start Time Tracking by File Path
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/obsidian-cli.md
Start time tracking for a task by specifying its full file path within the vault. This method ensures precise task identification.
```bash
obsidian tasknotes:start-time vault=test path="TaskNotes/Write release notes.md"
```
--------------------------------
### POST /api/tasks/:id/time/start-with-description
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Starts time tracking for a task and adds a description to the new active entry.
```APIDOC
## POST /api/tasks/:id/time/start-with-description
### Description
Starts time tracking and writes `description` on the new active entry.
### Method
POST
### Endpoint
/api/tasks/:id/time/start-with-description
### Parameters
#### Request Body
- **description** (string) - Required - Implementation
```
--------------------------------
### JSON Transform File Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/webhooks.md
Define custom webhook payload structures using JSON transform files. This example shows how to format a 'task.completed' event and provides a default structure for other events.
```json
{
"task.completed": {
"text": "Task completed: ${data.task.title}",
"vault": "${vault.name}"
},
"default": {
"text": "TaskNotes event: ${event}"
}
}
```
--------------------------------
### Define text properties
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/settings/property-types-reference.md
Examples of basic text-based task properties.
```yaml
title: "Complete project documentation"
```
```yaml
status: "in-progress"
```
```yaml
priority: "high"
```
--------------------------------
### List all configuration settings
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/mdbase-tasknotes-cli.md
Displays all current configuration settings.
```bash
mtn config --list # Show all settings
```
--------------------------------
### Example TaskNotes Workflow
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/companion-plugins/tasknotes-workflows.md
A complete workflow definition that starts time tracking when a task status changes to active. It includes triggers, conditions, and steps.
```yaml
---
type: tasknotes-workflow
schemaVersion: 1
id: auto-start-time-tracking
name: Auto-start time tracking
enabled: false
description: Start a timer when a task status changes to active.
triggers:
- id: status-active
type: tasknotes.event
event: task.status.changed
to: active
conditions:
- field: trigger.after.path
operator: exists
steps:
- id: start-time
type: time.start
input:
task: "{{trigger.after.path}}"
options:
description: "Started by {{workflow.name}}"
run:
mode: sequential
noOverlap: true
source: tasknotes-workflows
maxTasks: 1
onError: stop
---
# Auto-start time tracking
Enable this workflow to start time tracking when a TaskNotes task moves to `active`.
```
--------------------------------
### Namespaced API Usage Examples
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/javascript-api.md
Illustrates the usage of the namespaced TaskNotes API for common operations like updating tasks, retrieving subtasks, and starting timers.
```APIDOC
## Namespaced API Usage Examples
### Description
This section provides examples of how to use the namespaced TaskNotes API for various operations. Using namespaces is the recommended approach for new code.
### Method
JavaScript (async/await)
### Endpoint
N/A (Runtime API)
### Parameters
N/A
### Request Example
```javascript
// Update a task's status
await api.tasks.update("Tasks/example.md", { status: "active" });
// Get subtasks for a given path
const subtasks = await api.relationships.subtasks("Tasks/example.md");
// Start a time entry
await api.time.start("Tasks/example.md", { description: "Deep work" });
// Start a pomodoro timer for a task
await api.pomodoro.start({ taskPath: "Tasks/example.md", duration: 25 });
```
### Response
Results depend on the specific method called (e.g., updated task info, array of subtasks, timer status).
```
--------------------------------
### Component and Utility Pattern Example
Source: https://github.com/callumalpass/tasknotes/blob/main/styles/UTILITIES.md
Demonstrates a good practice of using a base component (`tn-task-card`) and augmenting it with utility classes for layout, spacing, and alignment.
```html
Task Title
In Progress
Task description...
```
--------------------------------
### Get Merged Calendar Events
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Retrieves a merged list of events from connected providers and ICS subscriptions. Requires 'start' and 'end' ISO date/datetime query parameters.
```bash
GET /api/calendars/events
```
--------------------------------
### Project Suggestion Card Configuration Tokens
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/features/task-management.md
Token syntax examples for configuring multi-row project suggestion cards in settings.
```text
{title|n(Title)}
```
```text
🔖 {aliases|n(Aliases)}
```
```text
{file.path|n(Path)|s}
```
--------------------------------
### Using Namespaced API Methods
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/javascript-api.md
Interact with TaskNotes features using the preferred namespaced API. Examples include updating tasks, retrieving subtasks, and starting timers or pomodoros.
```javascript
await api.tasks.update("Tasks/example.md", { status: "active" });
const subtasks = await api.relationships.subtasks("Tasks/example.md");
await api.time.start("Tasks/example.md", { description: "Deep work" });
await api.pomodoro.start({ taskPath: "Tasks/example.md", duration: 25 });
```
--------------------------------
### Listen for Task Status Changes
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/javascript-api.md
An example of an automation-style listener that starts a timer when a task's status changes to 'active'. It includes logic to prevent self-triggering and uses a random UUID for correlation if not provided.
```javascript
const source = "my-workflow-plugin";
this.registerEvent(
api.events.on("task.status.changed", async (event) => {
if (event.source === source) {
return;
}
if (event.after?.status !== "active") {
return;
}
await api.time.start(event.after.path, undefined, {
source,
correlationId: event.correlationId ?? crypto.randomUUID(),
reason: "status changed to active",
});
})
);
```
--------------------------------
### forEach Step Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/companion-plugins/tasknotes-workflows.md
Use 'forEach' to run a step for each item in a collection. '{{item}}' refers to the current item, and the step output becomes an array of per-item outputs.
```yaml
steps:
- id: overdue
type: task.query
input:
query:
where:
all:
- field: task.due
op: lt
value:
fn: today
- field: task.status
op: notIn
value:
- done
- cancelled
sort:
- field: task.due
direction: asc
limit: 50
scope:
includeArchived: false
- id: mark-high
type: task.patch
forEach: "{{steps.overdue.tasks}}"
input:
task: "{{item.path}}"
patch:
priority: high
```
--------------------------------
### Launch interactive mode
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/mdbase-tasknotes-cli.md
Starts an interactive REPL for creating tasks with live Natural Language Processing (NLP) preview.
```bash
mtn interactive
```
```bash
# or
mtn i
```
--------------------------------
### List all projects
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/mdbase-tasknotes-cli.md
Lists all available projects. The --stats flag shows completion percentages.
```bash
mtn projects list
```
```bash
mtn projects list --stats # With completion percentages
```
--------------------------------
### Define a complete task with all property types
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/settings/property-types-reference.md
Example of a YAML frontmatter block demonstrating all available task property types.
```yaml
---
title: "Complete quarterly report"
status: "in-progress"
priority: "high"
due: "2025-01-31"
scheduled: "2025-01-25"
tags:
- work
- reports
contexts:
- office
projects:
- "[[Q1 Planning]]"
timeEstimate: 240
dateCreated: "2025-01-01T08:00:00Z"
dateModified: "2025-01-20T14:30:00Z"
timeEntries:
- startTime: "2025-01-20T10:00:00Z"
endTime: "2025-01-20T11:30:00Z"
blockedBy:
- uid: "tasks/gather-data.md"
reltype: "FINISHTOSTART"
reminders:
- id: "rem_1"
type: "relative"
relatedTo: "due"
offset: "-P1D"
description: "Due tomorrow"
---
```
--------------------------------
### Early Start Recurring Task Configuration
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/features/recurring-tasks.md
Defines a weekly task starting before the official DTSTART date.
```yaml
# Early start before DTSTART
recurrence: "DTSTART:20250810T090000Z;FREQ=WEEKLY;BYDAY=MO"
scheduled: "2025-08-07T14:00"
```
--------------------------------
### Example Manual Command Workflow
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/companion-plugins/tasknotes-workflows.md
A sample workflow that can be triggered manually from the command palette. It queries for active tasks and displays their count in an Obsidian notice. Ensure the workflow is enabled and configured correctly.
```yaml
---
type: tasknotes-workflow
schemaVersion: 1
id: show-active-count
name: Show active task count
enabled: true
description: Show a notice with the number of active tasks.
triggers:
- id: manual
type: manual
steps:
- id: active
type: task.query
input:
query:
where:
field: task.status
op: eq
value: active
limit: 25
scope:
includeArchived: false
- id: notice
type: notice.show
input:
message: "Active tasks: {{steps.active.count}}"
run:
mode: sequential
noOverlap: true
source: tasknotes-workflows
maxTasks: 25
onError: stop
---
```
--------------------------------
### Run Local Test Webhook Server
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/webhooks.md
Execute this command to start a local Node.js server for testing webhook integrations. You can specify a custom port if the default is in use.
```bash
node test-webhook.js
```
```bash
node test-webhook.js 8080
```
--------------------------------
### Implement Interactive UI Elements
Source: https://github.com/callumalpass/tasknotes/blob/main/styles/UTILITY-USAGE-GUIDE.md
Demonstrates how to create interactive elements like hover effects on cards, focus states on inputs, and disabled states on buttons using provided utility classes.
```html
Hover me for effects
```
--------------------------------
### Slack Webhook Transform Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/releases/3.20.0.md
Example of a webhook transform for Slack, formatting task event data into compatible attachments.
```javascript
{
"transforms": [
{
"event": "task.created",
"transform": "slack.js",
"slack": {
"attachments": [
{
"fallback": "New task created: {{task.title}}",
"color": "#36a64f",
"pretext": "A new task has been added to TaskNotes.",
"author_name": "TaskNotes",
"title": "{{task.title}}",
"text": "{{task.description}}",
"fields": [
{
"title": "Status",
"value": "{{task.status}}",
"short": true
},
{
"title": "Priority",
"value": "{{task.priority}}",
"short": true
}
],
"ts": {{timestamp}}
}
]
}
}
]
}
```
--------------------------------
### Microsoft Teams Webhook Transform Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/releases/3.20.0.md
Example of a webhook transform for Microsoft Teams using the MessageCard format for task event notifications.
```javascript
{
"transforms": [
{
"event": "task.deleted",
"transform": "msteams.js",
"msteams": {
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"summary": "Task Deleted: {{task.title}}",
"themeColor": "FF0000",
"title": "Task Deleted",
"text": "The task \"**{{task.title}}**\" has been deleted.",
"sections": [
{
"activityTitle": "Task Details",
"facts": [
{
"name": "Title",
"value": "{{task.title}}"
},
{
"name": "Status",
"value": "{{task.status}}"
}
]
}
]
}
}
]
}
```
--------------------------------
### Workflow Task Selection Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/development/runtime-api-query-contract.md
Demonstrates how to select tasks within a workflow using the task.query step, specifying filtering and sorting criteria.
```yaml
steps:
- id: due-now
type: task.query
input:
query:
where:
all:
- field: task.status
op: notIn
value: [done, cancelled]
- field: task.due
op: lte
value:
fn: today
sort:
- field: task.due
direction: asc
limit: 50
- id: mark-high
type: task.patch
forEach: "{{steps.due-now.tasks}}"
input:
task: "{{item.path}}"
patch:
priority: high
```
--------------------------------
### Run Unit Tests for Settings and Issues
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/development/refactor-smoke-checks.md
Execute specific unit tests related to settings persistence, data JSON writes, and settings coalescing after plugin startup, settings persistence, or migration refactors.
```bash
npm test -- --runInBand tests/unit/settings/settingsPersistence.test.ts tests/unit/issues/issue-1591-settings-lost-on-update.test.ts tests/unit/issues/issue-1669-data-json-frequent-writes.test.ts tests/unit/issues/issue-1419-settings-save-coalescing.test.ts
```
--------------------------------
### Discord Webhook Transform Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/releases/3.20.0.md
Example of a webhook transform for Discord, creating rich embeds with colors based on task event data.
```javascript
{
"transforms": [
{
"event": "task.updated",
"transform": "discord.js",
"discord": {
"embeds": [
{
"title": "Task Updated: {{task.title}}",
"description": "{{task.description}}",
"color": "{{#if task.completed}}525252{{else}}{{#if task.priority}}16711680{{else}}3447003{{/if}}{{/if}}",
"fields": [
{
"name": "Status",
"value": "{{task.status}}",
"inline": true
},
{
"name": "Priority",
"value": "{{task.priority}}",
"inline": true
},
{
"name": "Folder",
"value": "{{task.folder}}",
"inline": true
}
]
}
]
}
}
]
}
```
--------------------------------
### POST /api/tasks/query - Root Group Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
An example of a root group for advanced task filtering. This structure defines conditions and sorting for querying tasks.
```JSON
{
"type": "group",
"id": "root",
"conjunction": "and",
"children": [
{
"type": "condition",
"id": "c1",
"property": "status",
"operator": "is",
"value": "open"
}
],
"sortKey": "due",
"sortDirection": "asc"
}
```
--------------------------------
### Split Layout Example
Source: https://github.com/callumalpass/tasknotes/blob/main/styles/UTILITIES.md
Creates a layout with a main content area that grows and a fixed-width sidebar. It stacks vertically on small screens and becomes a horizontal split on large screens.
```html
```
--------------------------------
### Verify Webhook Signature (Node.js Example)
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/webhooks.md
Example code for verifying the signature of an incoming webhook payload using Node.js. This ensures the request genuinely originated from TaskNotes.
```APIDOC
## Signature Verification
When `corsHeaders` is enabled, TaskNotes sends `X-TaskNotes-Event`, `X-TaskNotes-Signature`, and `X-TaskNotes-Delivery-ID` headers. The signature is an HMAC-SHA256 hash of the payload, using the webhook's secret.
### Node.js Example
```javascript
const crypto = require("crypto");
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac("sha256", secret)
.update(JSON.stringify(payload))
.digest("hex");
return signature === expected;
}
```
```
--------------------------------
### Create a Card with a Hover-Activated Actions Menu
Source: https://github.com/callumalpass/tasknotes/blob/main/styles/UTILITY-USAGE-GUIDE.md
This example shows how to build a card component where an actions menu becomes visible only when the user hovers over the card.
```html
Task Title
Task description goes here...
```
--------------------------------
### YAML Frontmatter Storage Example
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/features/user-fields.md
Shows how a user-defined field property is represented as a key-value pair within the task note's frontmatter.
```yaml
---
my_field: value
---
```
--------------------------------
### POST /api/tasks/:id/time/start-with-description
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Starts time tracking for a specific task and includes a description for the new active time entry. This is useful for logging the specific activity being tracked.
```JSON
{
"description": "Implementation"
}
```
--------------------------------
### Get configuration value
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/mdbase-tasknotes-cli.md
Retrieves the value of a specific configuration setting.
```bash
mtn config --get collectionPath # Get a setting
```
--------------------------------
### Efficient Utility Class Usage
Source: https://github.com/callumalpass/tasknotes/blob/main/styles/UTILITY-USAGE-GUIDE.md
Demonstrates the recommended approach of combining utility classes for efficient styling versus avoiding excessive stacking which can lead to verbose and less maintainable code.
```html
Content
Content
```
--------------------------------
### GET /api/filter-options
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Retrieves filter options suitable for UI builders.
```APIDOC
## GET /api/filter-options
### Description
Returns filter options for UI builders.
### Method
GET
### Endpoint
/api/filter-options
```
--------------------------------
### Get Webhook Deliveries
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Returns the last 100 delivery records for webhooks.
```bash
GET /api/webhooks/deliveries
```
--------------------------------
### POST /api/tasks/:id/time/start
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/HTTP_API.md
Starts a new active time entry for a specified task.
```APIDOC
## POST /api/tasks/:id/time/start
### Description
Starts a new active time entry for that task.
### Method
POST
### Endpoint
/api/tasks/:id/time/start
```
--------------------------------
### Run Unit Tests for Bootstrap and Default Bases
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/development/refactor-smoke-checks.md
Execute unit tests focused on default bases files regeneration after plugin startup, settings persistence, or migration refactors.
```bash
npm test -- --runInBand tests/unit/bootstrap/defaultBasesFiles.test.ts tests/unit/issues/issue-1495-default-bases-regenerate.test.ts
```
--------------------------------
### Occurrence Note Frontmatter
Source: https://github.com/callumalpass/tasknotes/blob/main/docs/features/recurring-tasks.md
Example of the frontmatter properties included in a materialized occurrence note.
```yaml
recurrence_parent: "[[Tasks/Weekly review]]"
occurrence_date: "2026-06-01"
scheduled: "2026-06-01T09:30"
timeEstimate: 45
```