feat: Enhance note creation with custom extensions and improved filefiltering #339
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.
Proposed change
New feature.
Enhanced the note creation functionality to handle custom file extensions provided by the user in a single input prompt. This update allows users to specify the note title and desired file extension together. The change ensures that the global M.Cfg.extension is temporarily overridden to prevent appending an additional default extension during file creation. Additionally, support for filtering files in the vault based on multiple extensions has been added, allowing more flexible file type management.
Type of change
New feature
Added
CreateNoteWithCustomExtension
function to correctly handle custom file extensions provided by the user. The function now prompts the user to enter the note title with the desired extension in a single input. To avoid appending the globally defined extension, the global M.Cfg.extension is temporarily overridden during the file creation process.Refactoring the custom extension handling function to support multiple extensions was challenging due to the extensive use of the global extension variable (M.Cfg.extension) across various inherited functions. This global dependency made it difficult to directly modify the extension handling without affecting core functionalities.
To enable file filtering in the vault based on multiple extensions, users can configure this by assigning a table with one or more file extensions in the configuration. Example:
This enhancement addresses significant challenges due to existing dependencies on the global extension variable and improves file management within the vault.
While backlinks, file searching and creating new files works the gf doesn't follow the links for the default extension if it doesn't have an extension. E.g. [[test]] would work but [[test.md]] would
Additional information
Checklist
.stylua.toml
file is provided).luacheckrc
file is provided)README.md
has been updated according to this change.doc/telekasten.txt
helpfile has been updated according to this change.