Skip to content

Template Engine for Daily Notes #287

@ElioNeto

Description

@ElioNeto

Template Engine for Daily Notes

Build a template system that automatically generates notes from templates, with built-in support for daily notes (journaling).

Features

Template Storage

  • Store templates as special notes under templates/ folder:
    • templates/daily.md — Daily note template
    • templates/weekly.md — Weekly review template
    • templates/project.md — Project template
    • templates/custom/{name}.md — User-defined templates

Template Syntax

Use Handlebars/Mustache-like syntax:

# {{title}}

**Date:** {{date}}
**Week:** {{week_number}}

## Goals
- [ ] Goal 1
- [ ] Goal 2

## Notes

## Tasks
{{#each tasks}}
- [ ] {{this}}
{{/each}}

## Linked Notes
{{#each backlinks}}
- [[{{this}}]]
{{/each}}

Built-in template variables:

  • {{date}} — Current date (YYYY-MM-DD)
  • {{time}} — Current time (HH:MM)
  • {{week_number}} — ISO week number
  • {{title}} — Note title
  • {{path}} — Note path
  • {{tags}} — Comma-separated tags from frontmatter
  • {{backlinks}} — Notes linking to this note

Daily Notes

  • POST /notes/daily — Create or open today's daily note
  • Daily note path format: daily/YYYY-MM-DD.md
  • Auto-populated from templates/daily.md
  • Configurable daily note folder and template

Template Management API

GET    /templates                          — List all templates
GET    /templates/{name}                   — Get template content
PUT    /templates/{name}                   — Create/update template
DELETE /templates/{name}                   — Delete template
POST   /notes/from-template?template=name&path=target  — Create note from template

Configuration

pub struct NoteTemplateConfig {
    pub daily_notes_folder: String,      // Default: "daily"
    pub daily_template: String,          // Default: "templates/daily.md"
    pub enable_auto_daily: bool,         // Auto-create daily note on first write of day
    pub custom_delimiter: (String, String), // Template delimiters, default: ("{{", "}}")
}

Acceptance Criteria

  • Template variables are correctly substituted
  • Daily note is created on demand with correct date
  • Custom templates can be created, listed, and deleted
  • {{backlinks}} enumeration works
  • Unit tests for template rendering
  • Integration tests for template API

Parent Epic

#275

Metadata

Metadata

Assignees

No one assigned

    Labels

    featnotesNote storage and indexingobsidianObsidian-like note-taking features

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions