Skip to content

Conversation

@rdick
Copy link

@rdick rdick commented Dec 2, 2025

Pull Request: Enhanced Inline Task Conversion with Dynamic Folder Paths and Custom File Names

Background

The Problem:
I wanted to quickly jot down tasks in my daily notes and convert them to TaskNotes, but they would land in generic folders with generic filenames, requiring manual reorganization.

Example task in daily note:

- [ ] Fix bug in repo #project/Microsoft

What I needed to happen automatically:

Requirement Example
Auto-route by project Extract "Microsoft" from #project/Microsoft → save to (4) Projects/Microsoft/Tasks/
Date-prefixed filenames Create filename 2025-11-28 - Fix bug in repo.md for chronological sorting
Clean task titles Keep task title as "Fix bug in repo" in frontmatter (no date prefix)
Fallback for untagged tasks Tasks without #project/ tags → route to (4) Projects/RD/Tasks/

This PR makes it possible:

Task: - [ ] Fix bug in repo #project/Microsoft

Folder template:  (4) Projects/${tags.find(t => t.startsWith('project/'))?.split('/')[1] || 'RD'}/Tasks
Filename template: {{year}}-{{month}}-{{day}} - {{title}}

Result ✓
  📁 Folder:   (4) Projects/Microsoft/Tasks/
  📄 Filename: 2025-11-28 - Fix bug in repo.md
  📝 Title:    "Fix bug in repo" (no date in frontmatter)

Benefit: Quick task capture → automatic organization by project with date-based filenames. No manual filing needed.

Summary

Adds powerful customization for inline task conversion through two main feature areas: dynamic folder organization with JavaScript expressions and relative paths, and custom file naming with template variables.

Part 1: Folder Organization Features

1. Template Variables in Folder Paths

Use {{variable}} syntax for dynamic folder organization.

Examples:

// Date-based organization
{{year}}/{{month}}
Task: "Review Q4 goals"  2025/11/

// Priority folders
Tasks/{{priority}}
Task: "Fix bug !high"  Tasks/high/

// Multi-level with status
{{year}}/Q{{quarter}}/{{status}}
Task: "*in-progress Plan roadmap"  2025/Q4/in-progress/

2. JavaScript Expressions in Folder Templates

Use ${...} syntax for conditional logic and complex transformations.

Examples:

// Extract project from nested tags
${tags.find(t => t.startsWith('project/'))?.split('/')[1] || 'Inbox'}/Tasks
Task: "Review code #project/WebApp"  WebApp/Tasks/

// Priority-based routing with conditionals
${priority === 'high' ? 'Urgent' : priority === 'medium' ? 'Normal' : 'Later'}
Task: "Fix bug !high"  Urgent/

// Get first context with fallback
${contexts?.[0] || 'Inbox'}
Task: "Call client @office @phone"  office/

3. Relative Path Support

Navigate folders relative to the current note's location.

Examples:

Current note: Projects/Planning/Meeting.md

Template: ../Archive/{{year}}
Result: Projects/Archive/2025/

Template: ./Tasks
Result: Projects/Planning/Tasks/

Template: ../../Inbox
Result: Inbox/

Part 2: File Naming Features

Custom File Name Templates

Define dynamic file naming patterns using template variables and JavaScript expressions. Enabled via toggle in settings.

UI Features:
image

Template Variables:

// Date-based naming
{{year}}-{{month}}-{{day}} - {{title}}
 "2025-11-28 - Buy groceries.md"

// Priority prefix
{{priority}}-{{title}}
 "high-Buy groceries.md"

JavaScript Expressions:

// Priority prefix with conditional
${priority === 'high' ? 'URGENT' : priority} - {{title}}
 "URGENT - Fix bug.md"

// Project prefix from tags
${tags.find(t => t.startsWith('project/'))?.split('/')[1]?.toUpperCase() || 'GENERAL'}-{{title}}
 "WEBAPP-Fix login bug.md"

// Conditional prefix based on tags
${tags.includes('meeting') ? 'Meeting' : 'Task'}-{{year}}-{{month}}-{{day}}
 "Meeting-2025-11-28.md"

Documentation

  • inline-tasks-folder-for-converted-tasks.md (314 lines): Folder organization guide with 13 examples
  • inline-task-filename-for-converted-tasks.md (413 lines): File naming patterns and title transformations
  • Updated inline-tasks.md with links to new guides

Template Variables Available

Date & Time: {{year}}, {{month}}, {{day}}, {{date}}, {{time}}, {{timestamp}}, {{hour}}, {{minute}}, {{second}}, {{week}}, {{quarter}}, {{monthName}}, {{monthNameShort}}, {{dayName}}, {{dayNameShort}}

Task Properties: {{title}}, {{status}}, {{priority}}, {{due}}, {{scheduled}}, {{recurrence}}, {{timeEstimate}}, {{archived}}, {{dateCreated}}, {{dateModified}}

Arrays: {{tags}}, {{contexts}}, {{projects}} (auto-join with / or use as arrays in ${...})

JavaScript: All variables available in ${...} expressions with full array/string methods

Technical Implementation

  • Reuses existing code: Custom filenames use processFolderTemplate() for consistency
  • Type-safe: Full TypeScript support with proper interfaces
  • Graceful fallbacks: Errors/empty results fall back to standard behavior
  • No breaking changes: All features disabled by default

New Settings:

enableCustomInlineFileName: boolean;  // Default: false
customInlineFileName: string;         // Default: "{{title}}"

Testing

1,026 new test cases covering:

  • Relative path resolution (142 tests)
  • Folder template processing with JS expressions (221 tests)
  • Custom filename templates (663 tests)
  • Edge cases: empty strings, special characters, undefined values, path normalization, sanitization, fallbacks

Files Changed

15 files, ~2,100 lines added

Core: TaskService.ts, folderTemplateProcessor.ts, filenameGenerator.ts, helpers.ts, settings.ts, defaults.ts, i18n/resources/en.ts

UI: featuresTab.ts

Tests: helpers.test.ts, folderTemplateProcessor.test.ts, filenameGenerator.custom-filename.test.ts, TaskService.test.ts

Docs: inline-tasks-folder-for-converted-tasks.md (NEW), inline-task-filename-for-converted-tasks.md (NEW), inline-tasks.md (updated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant