Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid YAML frontmatter deletes the whole frontmatter #712

Open
Julian opened this issue Sep 13, 2024 · 1 comment
Open

Invalid YAML frontmatter deletes the whole frontmatter #712

Julian opened this issue Sep 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Julian
Copy link

Julian commented Sep 13, 2024

🐛 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%                                                                                                                                                                                                                                                                                                          ```
@Julian Julian added the bug Something isn't working label Sep 13, 2024
@Julian
Copy link
Author

Julian commented Sep 15, 2024

For cross-reference because I just saw it, #509 is related in that the behavior I reported here is observed there (invalid YAML deletes what was added). But I personally still think this is undesirable general behavior in any case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant