Skip to content

feat(list): add checkbox completion timestamps#188

Merged
YousefHadder merged 4 commits intomainfrom
feat/checkbox-completion-timestamps
Dec 28, 2025
Merged

feat(list): add checkbox completion timestamps#188
YousefHadder merged 4 commits intomainfrom
feat/checkbox-completion-timestamps

Conversation

@YousefHadder
Copy link
Copy Markdown
Owner

Summary

Add automatic completion timestamps when checking tasks, similar to Obsidian-style task tracking.

  • Adds configurable timestamp formats: emoji (✅ 2025-12-28), comment (<!-- completed: 2025-12-28 -->), dataview ([completion:: 2025-12-28]), parenthetical ((completed: 2025-12-28))
  • Supports custom date formats via os.date() format strings
  • Configurable behavior for unchecking (remove or preserve timestamp) and re-checking (update or preserve existing timestamp)

Configuration

require('markdown-plus').setup({
  list = {
    checkbox_completion = {
      enabled = true,           -- Enable completion timestamps
      format = 'emoji',         -- 'emoji', 'comment', 'dataview', 'parenthetical'
      date_format = '%Y-%m-%d', -- os.date() format string
      remove_on_uncheck = true, -- Remove timestamp when unchecking
      update_existing = true,   -- Update timestamp when re-checking
    },
  },
})

Example

- [ ] Buy groceries     →  - [x] Buy groceries ✅ 2025-12-28

Test Plan

  • All existing tests pass (555 tests)
  • New tests for config validation (9 tests)
  • New tests for checkbox completion behavior (16 tests)
  • Manual testing with all four formats
  • make check passes (lint, format, tests)

Closes #186

Add automatic completion timestamps when checking tasks, similar to
Obsidian-style task tracking. When enabled, checking a checkbox appends
a configurable timestamp to the task line.

Features:
- Four timestamp formats: emoji, comment, dataview, parenthetical
- Configurable date format via os.date() format string
- Option to remove timestamp on uncheck
- Option to update existing timestamp when re-checking

Configuration:
  list = {
    checkbox_completion = {
      enabled = false,
      format = "emoji",
      date_format = "%Y-%m-%d",
      remove_on_uncheck = true,
      update_existing = true,
    },
  }

Closes #186
Copilot AI review requested due to automatic review settings December 28, 2025 20:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic completion timestamps to checkbox toggles, inspired by Obsidian-style task tracking. When a task is checked, a configurable timestamp is automatically appended to the task text. The feature supports four different timestamp formats (emoji, comment, dataview, parenthetical) and provides fine-grained control over timestamp behavior when unchecking or re-checking tasks.

Key Changes:

  • Added checkbox_completion configuration with 5 options: enabled, format, date_format, remove_on_uncheck, and update_existing
  • Extended checkbox toggle logic to conditionally add, update, or remove timestamps based on configuration
  • Comprehensive test coverage (25 new tests) for all timestamp formats and configuration options

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
lua/markdown-plus/types.lua Added LuaCATS type annotations for ListConfig and CheckboxCompletionConfig to define the new configuration structure
lua/markdown-plus/init.lua Added default configuration for list.checkbox_completion with sensible defaults (disabled by default)
lua/markdown-plus/config/validate.lua Added validation for the new list and checkbox_completion config fields, including format enum validation
lua/markdown-plus/list/init.lua Integrated checkbox module setup with list-specific configuration passing
lua/markdown-plus/list/checkbox.lua Implemented core timestamp functionality: format definitions, timestamp generation/removal, and integrated with checkbox toggle logic
spec/markdown-plus/config_spec.lua Added 9 tests validating configuration acceptance and rejection for the new fields
spec/markdown-plus/list_spec.lua Added 16 tests covering all timestamp formats, configuration options, and integration with existing checkbox features

Copilot AI review requested due to automatic review settings December 28, 2025 20:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

@YousefHadder YousefHadder merged commit 05084a4 into main Dec 28, 2025
15 checks passed
@YousefHadder YousefHadder deleted the feat/checkbox-completion-timestamps branch December 28, 2025 20:44
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.

[FEATURE] Obsidian style task completion

2 participants