Skip to content

Conversation

@kayacancode
Copy link

@kayacancode kayacancode commented Oct 3, 2025

Enhanced Frontmatter Rules

This PR enhances the frontmatter rules system to be more universal and flexible, allowing users to create automatic icon rules for any frontmatter field.

Features Added:

  • Universal frontmatter field support - Create rules for any field, not just specific ones
  • Multiple example rules - Quality Score, Priority, Status examples (disabled by default)
  • Real-time updates when frontmatter changes
  • "Apply to All Files" button for immediate rule application
  • Flexible rule configuration - Support for equals, greater-than, contains operators
  • Setup guide with multiple use case examples

How it works:

  1. Create rules in Settings → Iconize → Frontmatter Rules
  2. Add frontmatter to any note:
    ---
    Priority: High
    Status: Complete
    Category: Work
    ---
  3. Icons appear automatically based on your configured rules
  4. Works with any field - Priority, Status, Category, Quality Score, etc.

Example Use Cases:

  • Quality Score: Bookmark high-quality content
  • Priority: Flag important files
  • Status: Mark completed tasks
  • Category: Organize by type
  • Any custom field: Create rules for your specific workflow

Technical Changes:

  • Enhanced frontmatter rule evaluation timing
  • Added multiple example rules (disabled by default)
  • Improved rule management UI with "Apply to All Files" button
  • Better metadata cache handling for real-time updates
  • Universal field support - not hardcoded to specific fields

This makes the frontmatter rules system truly flexible for any user's workflow!

This commit introduces a new feature that allows users to define rules based on
frontmatter properties in their markdown files to automatically assign icons.

Key changes include:
- Added `inFrontmatterRule` property to `CacheResult` interface in `src/lib/icon-cache.ts`
  to track icons applied via frontmatter rules.
- Integrated `frontmatterRule.evaluateFileRules` into `file-open` and `modify`
  events in `src/main.ts` to ensure dynamic icon updates based on frontmatter changes.
- Enabled `frontmatterRulesEnabled` by default and added a sample "Quality Score Rule"
  with the `libookmark` icon in `src/settings/data.ts`. This rule demonstrates
  how icons can be applied when a specific frontmatter field meets a defined criterion.
- Add automatic bookmark icons for files with quality scores in frontmatter
- Support both 'Quality Score' and 'quality score' field names (case-insensitive)
- Add frontmatter rule evaluation on file modification with proper timing
- Include default frontmatter rules for quality score detection
- Add 'Apply to All Files' button for immediate rule application
- Include setup guide for the new feature

This feature automatically adds bookmark icons to files that have a quality score greater than 1 in their frontmatter, making it easy to visually identify high-quality content in the file explorer.
- Replace hardcoded 'Quality Score' rules with generic examples
- Add multiple example rules (Quality Score, Priority, Status) that are disabled by default
- Update setup guide to show frontmatter rules as a general feature, not just quality scores
- Include examples for different use cases (priority, status, category, etc.)
- Make the feature more flexible for any frontmatter field users want to use

This makes the feature truly universal - users can create rules for any frontmatter field, not just quality scores.
@kayacancode kayacancode changed the title feat: Add quality score bookmark feature feat: Enhanced frontmatter rules with universal field support Oct 3, 2025
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