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
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
Hey @rmenai I can definitely see the appeal of this. I tried implemented a Lua ordered table (see here) which would make this trivial, but it doesn't work with Lua 5.1 unfortunately. This isn't a complete blocker though, we could just frontmatter function return some other class that acts like ordered mapping, albeit without the default table API.
So, if someones interested in tackling this, here's what I would suggest:
Create an ordered mapping class in lua/obsidian/collections.lua.
Check for instances of that class in yaml.dump_lines and handle accordingly.
Alternatively we could allow generator functions to be returned from frontmatter_func, and handle those accordingly in yaml.dump_lines.
Hey @rmenai I can definitely see the appeal of this. I tried implemented a Lua ordered table (see here) which would make this trivial, but it doesn't work with Lua 5.1 unfortunately. This isn't a complete blocker though, we could just frontmatter function return some other class that acts like ordered mapping, albeit without the default table API.
So, if someones interested in tackling this, here's what I would suggest:
1. Create an ordered mapping class in `lua/obsidian/collections.lua`.
2. Check for instances of that class in [`yaml.dump_lines`](https://github.com/epwalsh/obsidian.nvim/blob/b833db80659066661100b6397d30ea179861bdbd/lua/obsidian/yaml/init.lua#L101-L103) and handle accordingly.
Alternatively we could allow generator functions to be returned from frontmatter_func, and handle those accordingly in yaml.dump_lines.
🐛 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
But instead I get this
Config
Environment
The text was updated successfully, but these errors were encountered: