feat(note): consolidate note creation options under note.* and add note.info (#575)#722
feat(note): consolidate note creation options under note.* and add note.info (#575)#722acidsugarx wants to merge 1 commit intoobsidian-nvim:mainfrom
Conversation
|
quick idea:
maybe it can be the last parameter I at least like just some if statements then some nested tables in customizations, and code can be simplified. what do you think |
|
Good idea, I like the direction. Passing template (and potentially more context) via an opts param to id_func/path_func is a clean win for the common case — if-statements in one function are definitely more readable than nested customization tables. A couple of things I found while looking at this:
So I'd say: add it as an additive change, keep customizations as-is. Let users pick whichever style fits:
Fully backwards-compatible since Lua ignores extra args/table keys. And opts is a nice extension point for the future Want me to put up a PR for this? |
|
Will this allow setting up a |
|
@metalelf0 this should be already possible with and @acidsugarx I'll need to give the changes more thought, and leave this migration stuff to next major 3.17 |
|
@neo451 oh, ok, this works! I was trying to use |
|
ok great, I'll keep your case in mind for #79 |
feat(note): consolidate note creation options under note.* and add note.info (#575)
What does the PR do?
This PR consolidates note-creation behavior under
opts.notewhile preserving backward compatibility with legacy top-level options.Related to #575
noteAdded/normalized:
note.id_funcnote.path_funcnote.templatenote.info(new, for preview text used in completion/hover-style docs)Top-level:
note_id_funcnote_path_funcare now treated as legacy aliases:
note.id_func/note.path_funcduring config normalizationNote._get_creation_opts()now carries a complete creation strategy:note_id_funcnote_path_functemplatenotes_subdirnew_notes_locationTemplate customizations can now also override:
note_path_functemplateSignature consistency
note_path_funcis now consistently treated with spec:{ id, dir, title }so
titleis available in path generation logic and typing/docs are aligned.Preview customization
Added
Note.info():opts.note.infocallbackstringorstring[]Note.display_info()if callback is missing/errors/returns invalid valueCompletion docs now call
note:info(...)instead of hardcodednote:display_info(...).PR Checklist
CHANGELOG.mdis updatedREADME.mdfilemake chores(for style, lint, types, and tests)