-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Sorting Notes with specific Metadata Tag #23
Comments
Hi @blaettlerio! the idea of the suggested feature seems promising! I've done some initial evaluation of how the implementation could behave and I've created a working prototype locally. This resulted in a bunch of questions. I don't want to overcomplicate the solution, at the same time I don't to oversimplify it Please take a look below points and let me know what you think: 1. First and foremost, do I understand how the feature should work?A note N1 contains YAML frontmatter with a metadata like:
A note N2 at the same time contains:
And you want to be able to tell the plugin (via custom sorting specification) to use the value of the metadata In result, if the sorting specified is alphabetical, the note N2 should go before N1. For reverse alphabetical order, N2 goes before N1. 2. If my undestanding in 1. is correct, then...... the potential syntax of specification could look like:
The above specification could be read as: in the folder 3. If 1. and 2. are fine, the intentional limitations of the implementation could be:
Let me know what you think :-) |
- added support for grouping items by the presence of specified metadata - new keyword `metadata:` introduced for that purpose in lexer - if metadata field name is omitted, the default `sort-index-value` is used - on top of the above, added support for sorting by the value of the specified metadata - unit tests of sorting spec processor extended accordingly
- readme update - minor finetuning of syntax for metadata
Hi @SebastianMC Thank you for your answer.
3.1. Think the a-z ascending or descending would be a neat starting point. First sort priority: Metadata 3.3. Good idea....did not think about that although I use folder notes too ;-) 3.4. Agree....constantly monitoring changes on a file level would be overkill. Let me know if you have other questions. |
- more advanced version of implementation: with-metadata and by-metadata support - readme update
- code example in README.md - indentation adjusted
A bit more advanced implementation is completed in the branch and ready to merge in the PR #26. Highlights of this new feature:
The simplest sorting config example discussed in previous notes would look like: sorting-spec: |
target-folder: Book notes
< a-z by-metadata: Pages |
- extended to also support true alphabetical on metadata fields
- release unnecessary references after sorting completed
* #23 - support for sorting by metadata - added support for grouping items by the presence of specified metadata - new keyword `with-metadata:` introduced for that purpose in lexer - if metadata field name is omitted, the default `sort-index-value` is used - added support for sorting items by notes and folders metadata - new keyword 'by-metadata:' introduced for that purpose - if metadata field name is omitted, the default `sort-index-value` is used (or metadata name inheritance is used) - unit tests of sorting spec processor extended accordingly - documentation and code example in README.md - extended to also support true alphabetical on metadata fields - release unnecessary references after sorting completed
Tested it! Works like a charm! Thank you for the fast implementation. |
Wondering if it would be possible to enhance the functionality of the plugin with the ability to sort notes in a folder with the help of a specific Metadata Tag?
Use Case:
If you are creating notes based on books I enter the the page number of the book within the metadata of the note.
Therefore it would be beneficial to have the option to sort the notes with that specific tag (e.g. Pages).
The text was updated successfully, but these errors were encountered: