epwalsh / epwalsh/obsidian.nvim
Frontmatter does not keep track of the fields' order
- Dominant language
- Lua
- Stars
- 6.2k
- Forks
- 250
- PR merge metrics
- No merged PRs in 30d
Description
### 🐛 Describe the bug
When I try to generate my own frontmatter, I noticed that it does not keep track of the order of the fields. I want to sort my fields based on the order of importance so I want to have
```md
---
title: ...
date: ...
tags: []
---
```
But instead I get this
```md
---
tags: []
date: ...
title: ...
---
```
### Config
```lua
local function generate_frontmatter(note)
local date = os.date("%Y-%m-%d %H:%M")
local out = { title = note.title, date = date, tags = note.tags }
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
for k, v in pairs(note.metadata) do
out[k] = v
end
end
return out
end
```
### Environment
```
NVIM v0.10.0
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
Obsidian.nvim v3.9.0 (d1ca121353681e8f7dc8a69c760b950e12bcde22)
Status:
• buffer directory: nil
• working directory: /home/rami/.config/nvim/lua/plugins
Workspaces:
✓ active workspace: Workspace(name='notes', path='/home/rami/Documents/Vaults/notes', root='/home/rami/Documents/Vaults/notes')
Dependencies:
✓ plenary.nvim: a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683
✓ nvim-cmp: d818fd0624205b34e14888358037fb6f5dc51234
Integrations:
✓ picker: TelescopePicker()
✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
all sources:
• nvim_lsp
Tools:
✓ rg: ripgrep 13.0.0
Environment:
• operating system: Wsl
Config:
• notes_subdir: nil
Contributor guide
Research direction
Start by tracing the generate_frontmatter callback shown in the issue into the plugin's frontmatter serialization path; no source file or test is named. Confirm how the returned fields are iterated, then verify that generated frontmatter retains the requested title, date, and tags order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100