Skip to content
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

FR: Option to replace "linter-yaml-title-alias" with title key #1044

Closed
BenJendyk opened this issue Mar 15, 2024 · 5 comments · Fixed by #1057
Closed

FR: Option to replace "linter-yaml-title-alias" with title key #1044

BenJendyk opened this issue Mar 15, 2024 · 5 comments · Fixed by #1057
Assignees
Labels
duplicate This issue or pull request already exists resolution/update-made A change has been made that should resolve this issue or request rule suggestion Suggestion to add or edit a rule yaml YAML related issues or features

Comments

@BenJendyk
Copy link

Is Your Feature Request Related to a Problem? Please Describe.

I utilize unique filenames for my notes, and the linter is an invaluable tool that reduces my workload by automatically inserting the file title into the alias section. The ability to use the linter-yaml-title-alias key is particularly helpful, as it eliminates the need to manually remove the old title from the alias section whenever I update the title. In addition to the YAML title alias, I use the YAML title option to insert the title as a separate key in the front matter. In my setup, the title key and the linter-yaml-title-alias always remain identical, serving very similar purposes - so similar, in fact, that I believe merging their functions, or at least providing the option to do so, could be beneficial.

Describe the Solution You'd Like

I propose adding an option in the "YAML Title" section to utilise the title as the key for assisting with filename and heading changes, in place of using linter-yaml-title-alias. If enabled, this feature would function identically to linter-yaml-title-alias, effectively replacing its role.

## YAML Title Alias

- Inserts the title of the file into the YAML frontmatter's aliases section. Gets the title from the first H1 or filename. 
- Preserve existing aliases section style
- Keep alias that matches the filename
- Use the YAML key linter-yaml-title-alias to help with filename and heading changes

## YAML Title

- Automatically inserts the file's title into the YAML front matter, determining the title based on the selected mode.
- Title Key
- Mode
- **Use the title key to help with filename and heading changes, supplanting the role of `linter-yaml-title-alias` when enabled.**
@BenJendyk BenJendyk added the rule suggestion Suggestion to add or edit a rule label Mar 15, 2024
@pjkaufman
Copy link
Collaborator

Hey @BenJendyk , this sounds like a duplicate of #561. Would it be correct to say that request satisfies what you are looking for?

@BenJendyk
Copy link
Author

Yes, even though I hadn't checked earlier, I think it's still a great chance to prioritize this issue. Especially since the original request was made about a year ago. I feel the linter-yaml-title-alias key is unnecessary and just adds clutter to the frontmatter.

As someone not really familiar with the technical details, I can only suggest ideas based on what seems logical:

  1. Allow users to rename the linter-yaml-title-alias key themselves.
  2. Add a separate button in the "YAML Title" section that overwrites the functionality of the linter-yaml-title-alias key with the title key.
  3. Include an option in the "YAML Title Alias" section where, if activated, the system checks if the linter-yaml-title-alias key matches the title key and, if so, ignores it in favor of the title key.

Option 1 seems like the most straightforward and elegant approach to me.

Thanks for your time and the effort invested in this project.

@pjkaufman
Copy link
Collaborator

I believe option 1 is the way to go. I am not sure if this will get touched soon by me at least since I am heads down on another issue that will likely take a lot of my time and concentration. I am open to PRs to make the requested change in the meantime.

@pjkaufman pjkaufman self-assigned this Mar 22, 2024
@pjkaufman
Copy link
Collaborator

I decided to go ahead and tackle this. It will likely be stuck in beta for at least a couple of weeks if not a month or more depending upon how the work I am doing on some of the larger more volatile changes goes. But if all things go smoothly it may turn out that this can get in an actual release before too long.

For now, I am just trying to add option 3. I am thinking of adding 1 or 2 tests for this and then pushing it up to master.

@pjkaufman pjkaufman added duplicate This issue or pull request already exists yaml YAML related issues or features labels Mar 22, 2024
@pjkaufman
Copy link
Collaborator

The change for this has been merged into master and should be in the next release. Please let us know if there are issues with it in either place. Thanks!

@pjkaufman pjkaufman added the resolution/update-made A change has been made that should resolve this issue or request label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists resolution/update-made A change has been made that should resolve this issue or request rule suggestion Suggestion to add or edit a rule yaml YAML related issues or features
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants