markdown-oxide icon indicating copy to clipboard operation
markdown-oxide copied to clipboard

"Unresolved Reference" on .md files in subfolders

Open yaboibigjohn opened this issue 4 months ago β€’ 5 comments

Summary

Links to md files in subdirectories from the root are not found by the LSP I have a strange feeling that I'm missing something obvious in my setup

Image

My setup code using Mason:

--setting up replace using Blink rather than cmp, seems to work fine
local capabilities = require('blink.cmp').get_lsp_capabilities()
local servers = {
  lua_ls = {
    settings = {
      Lua = {
        completion = {
          callSnippet = 'Replace',
        },
      },
    },
  },
  markdown_oxide = {
    capabilities = vim.tbl_deep_extend('force', capabilities, {
      workspace = {
        didChangeWatchedFiles = {
          dynamicRegistration = true,
        },
      },
    }),
  },
}
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
  'biome',
  'lua_ls',
  'stylua',
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }

yaboibigjohn avatar Jul 25 '25 21:07 yaboibigjohn

I am also experiencing the same thing

Awesomerly avatar Aug 07 '25 17:08 Awesomerly

πŸ’Ž Feel-ix-343 is offering a $5 bounty for this issue. View and reward the bounty at algora.io/Feel-ix-343/markdown-oxide/issues/274

πŸ‘‰ Got a pull request resolving this? Claim the bounty by commenting /claim #274 in your PR and joining algora.io

algora-pbc avatar Aug 12 '25 02:08 algora-pbc

Hello @yaboibigjohn β€” I tried to reproduce the issue but couldn’t.

Test layout

issue_274/
β”œβ”€β”€ outer1.md
β”œβ”€β”€ outer2.md
└── subdir/
    └── inner.md

References from inner.md to outer1.md and outer2.md work as expected, and the reverse (outer to inner) also works.

From from what I've read of the codebase, markdown-oxide takes the workspace root from the LSP client (editor/IDE) and indexes all Markdown files under that root for reference resolution.

If you open your editor at the project root (issue_274/), cross-file references in subdirectories should resolve. If you instead open a single file directly, like this:

cd issue_274/subdir
$EDITOR inner.md

then the workspace root becomes subdir/, so only that subtree is indexed.

I’m using Helix on NixOS. From your screenshot it looks like Neovim on WSL. There could be editor/platform differences. If the issue stems from how the project is opened, you might try setting the working directory to the desired root (:cd {desired_root_dir}, according to the docs).

If it’s not a workspace-root issue, could you share how you’re opening the project and confirm your editor/OS? Thanks!

2coffee2crab avatar Aug 18 '25 13:08 2coffee2crab

Hi, This is not an issue in markdown-oxide. It is job of the client(neovim, helix, etc) to determine the workspace root and send it to the server(markdown-oxide lsp) when it is first initialized.

Please update the root marker in your respective editor.

For @yaboibigjohn, I assume its neovim. Based on docs it should look something like this:

vim.lsp.config['markdown_oxide'] = {
  cmd = { 'markdown-oxide' }, 
  filetypes = { 'markdown' },
  -- important, add .obsidian as a root marker
  root_markers = { '.obsidian', '.git' },
}

I think Mason is just a lsp manager, so it probably won't have options to configure this. I don't personally use neovim, so you might have to check a little.

mav3ri3k avatar Aug 22 '25 14:08 mav3ri3k

Im having the same issue, i can not "Go to the definition" in Helix when i have a file (.md) in a subfolder inside the root folder. Im using w11 and helix 25.07, i tried everything, i attach the error in log in helix:

2025-10-31T00:15:09.145 helix_term::application [ERROR] Language Server: Method workspace/semanticTokens/refresh not found in request 1 2025-10-31T00:16:14.125 helix_lsp::util [ERROR] Invalid LSP range start Position { line: 3, character: 2 } > end Position { line: 3, character: 1 }, using an empty range at the end instead 2025-10-31T00:16:15.776 helix_lsp::util [ERROR] Invalid LSP range start Position { line: 3, character: 2 } > end Position { line: 3, character: 1 }, using an empty range at the end instead 2025-10-31T00:18:04.524 helix_term::application [ERROR] Language Server: Method workspace/semanticTokens/refresh not found in request 2 2025-10-31T00:21:09.383 helix_term::application [ERROR] Language Server: Method workspace/semanticTokens/refresh not found in request 3 2025-10-31T00:22:33.084 helix_term::application [ERROR] Language Server: Method workspace/semanticTokens/refresh not found in request 4

Image

pablosanhueza-flow avatar Oct 31 '25 03:10 pablosanhueza-flow

I found that in Helix, links are resolved relative to the project root, rather than relative to the current file's directory.

So, ./sub_dir/file doesn't work, but ./current_dir/sub_dir/file does.

Huliiiiii avatar Dec 08 '25 10:12 Huliiiiii

Hi @Huliiiiii

Thanks for pointing that out. I resolved the issue by installing Helix on WSL2 (Ubuntu in Windows) along with the IWE extension, and all problems were solved.

pablosanhueza-flow avatar Dec 09 '25 17:12 pablosanhueza-flow