feat: Enhanced frontmatter rules with universal field support#671
Open
kayacancode wants to merge 8 commits intoFlorianWoelki:mainfrom
Open
feat: Enhanced frontmatter rules with universal field support#671kayacancode wants to merge 8 commits intoFlorianWoelki:mainfrom
kayacancode wants to merge 8 commits intoFlorianWoelki:mainfrom
Conversation
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.
Remove all debug console.log statements that were added for debugging purposes during development.
Remove console.log statements from onload() and onunload() methods. The only remaining console.log is in the logger utility which is intentional and controlled by debugMode setting.
Avoid crashing the plugin when switching icon packs by checking for undefined packs before calling delete() and ensure we only splice one entry from the registry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
How it works:
Example Use Cases:
Technical Changes:
This makes the frontmatter rules system truly flexible for any user's workflow!