You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the plugin exposes note_frontmatter_func which is of the type fun(note:obsidian.Note):table. The table is prepended to the current buffer on save.
Now, when the table is empty, this results in an unnecessary addition of empty frontmatter at the top of the file.
------
Other text....
I think it would be more intuitive if we checked the returned table using vim.tbl_isempty() and only inject the frontmatter if it has some content.
Alternatives
To not affect the defaults, if that is desirable, we could change the type of note_frontmatter_func to fun(note:obsidian.Note):table?.
The nil value would indicate that there is no frontmatter and that it should be removed from the current file.
Additional context
No response
The text was updated successfully, but these errors were encountered:
@UtkarshVerma I agree this would make sense. If you want to make a PR, I believe you'd just have to modify Note:frontmatter_lines() to return an empty list when vim.tbl_isempty():
🚀 The feature, motivation and pitch
Currently, the plugin exposes
note_frontmatter_func
which is of the typefun(note:obsidian.Note):table
. The table is prepended to the current buffer on save.Now, when the table is empty, this results in an unnecessary addition of empty frontmatter at the top of the file.
I think it would be more intuitive if we checked the returned table using
vim.tbl_isempty()
and only inject the frontmatter if it has some content.Alternatives
To not affect the defaults, if that is desirable, we could change the type of
note_frontmatter_func
tofun(note:obsidian.Note):table?
.The
nil
value would indicate that there is no frontmatter and that it should be removed from the current file.Additional context
No response
The text was updated successfully, but these errors were encountered: