Skip to content

Commit

Permalink
Do not write empty metadata to note (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
UtkarshVerma authored Mar 9, 2024
1 parent bd2b2a5 commit 78f572c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/obsidian/note.lua
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ Note.frontmatter_lines = function(self, eol, frontmatter)
local new_lines = { "---" }

local frontmatter_ = frontmatter and frontmatter or self:frontmatter()
if vim.tbl_isempty(frontmatter_) then
return {}
end

for line in
iter(yaml.dumps_lines(frontmatter_, function(a, b)
local a_idx = nil
Expand Down

0 comments on commit 78f572c

Please sign in to comment.