epwalsh / epwalsh/obsidian.nvim
Invalid YAML frontmatter deletes the whole frontmatter
- Dominant language
- Lua
- Stars
- 6.2k
- Forks
- 250
- PR merge metrics
- No merged PRs in 30d
Description
### 🐛 Describe the bug
Create a new note, and type some invalid frontmatter (below shown with markdown lists instead of YAML ones), e.g.:
```
---
id: Foo
aliases:
* bar
tags:
* foo
---
# Really Important Stuff
```
On save, the entire frontmatter is deleted and replaced with empty frontmatter.
This seems almost certainly like it should be filed somewhere, but apologies as I couldn't find it through a search.
### Config
```
return {
{
'epwalsh/obsidian.nvim',
version = '*',
ft = 'markdown',
cmd = {
'ObsidianOpen',
'ObsidianNew',
'ObsidianQuickSwitch',
'ObsidianFollowLink',
'ObsidianBacklinks',
'ObsidianTags',
'ObsidianToday',
'ObsidianYesterday',
'ObsidianTomorrow',
'ObsidianDailies',
'ObsidianTemplate',
'ObsidianSearch',
'ObsidianLink',
'ObsidianLinkNew',
'ObsidianLinks',
'ObsidianExtractNote',
'ObsidianWorkspace',
'ObsidianPasteImg',
'ObsidianRename',
'ObsidianToggleCheckbox',
'ObsidianNewFromTemplate',
'ObsidianTOC',
},
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {
workspaces = {
{
name = 'vault',
path = vim.env.XDG_DOCUMENTS_DIR .. '/Obsidian',
},
},
follow_url_func = vim.ui.open,
},
},
}
```
### Environment
```
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1725453128
Run "nvim -V1 -v" for more info
Obsidian.nvim v3.9.0 (ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b)
Status:
• buffer directory: nil
• working directory: /Users/julian/Documents/Obsidian
Workspaces:
✓ active workspace: Workspace(name='vault', path='/Users/julian/Documents/Obsidian', root='/Users/julian/Documents/Obsidian')
Dependencies:
✓ plenary.nvim: ec289423a1693aeae6cd0d503bac2856af74edaa
✓ nvim-cmp: ae644feb7b67bf1ce4260c231d1d4300b19c6f30
Integrations:
✓ picker: TelescopePicker()
✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
all sources:
• nvim_lsp
• nvim_lsp_signature_help
• path
• lazydev
• buffer
Tools:
✓ rg: ripgrep 14.1.1
Environment:
• operating system: Darwin
Config:
• notes_subdir: nil% ```
Contributor guide
Research direction
Reproduce the issue by creating a new note with the invalid YAML frontmatter shown in the report and saving it. Trace the frontmatter parsing and save path to determine why invalid input becomes empty frontmatter; done means the note's original frontmatter is not silently deleted, with behavior covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, yaml
- Domain
- content, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100