Skip to content

Conversation

@mikegreiner
Copy link

Description

Fixes #280 - Adds new searchType: frontmatter.exists that tracks days when a frontmatter field exists and is non-empty. This is useful for habit tracking where you just need to know if something happened, regardless of the value.

Changes

  • Added FrontmatterExists to SearchType enum
  • Implemented collectDataFromFrontmatterExists() function
  • Added validation and parsing support for "frontmatter.exists"
  • Updated all documentation (docs/Concepts.md, docs/InputParameters.md, docs/TargetEvaluation.md)
  • Added comprehensive unit tests (12 test cases, all passing)
  • Fixed pre-existing bug: .contains().includes() in helper.ts

Type of Change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Added unit tests (test/frontmatter-exists.test.ts) - all 12 tests passing
  • Added example file (examples/TestFrontmatter.md) demonstrating the feature
  • Tested backward compatibility - existing frontmatter behavior unchanged
  • Tested edge cases (empty strings, arrays, booleans, null, nested fields)
  • Tested with multiple frontmatter fields
  • Verified all tests run automatically without requiring Obsidian

Documentation

  • Updated docs/Concepts.md - Added frontmatter.exists to searchType list
  • Updated docs/InputParameters.md - Added to searchType description
  • Updated docs/TargetEvaluation.md - Added detailed section for frontmatter.exists
  • Added examples/TestFrontmatter.md demonstrating the feature

Related Issue

Closes #280

Mike Greiner added 2 commits December 20, 2025 18:25
Implements Issue pyrochlore#280: Adds new searchType that tracks days when a
frontmatter field exists and is non-empty, regardless of value.

Changes:
- Add FrontmatterExists to SearchType enum
- Implement collectDataFromFrontmatterExists() function
- Add validation and parsing support
- Update user documentation (Concepts, InputParameters, TargetEvaluation)
- Add example usage (TestFrontmatter.md)
- Add comprehensive unit tests (12 test cases)
- Fix pre-existing bug: .contains() → .includes() in helper.ts
- Add testing infrastructure (Jest, mocks, config)
- Update README with Development section

Testing:
- 12 unit tests covering all edge cases (all passing)
- Manual testing in Obsidian
- Backward compatibility verified

Fixes pyrochlore#280
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.

Tracking days when frontmatter field is non empty

1 participant