Tutorials 24 min read

A Link to Another Note Starts From a Different Folder in Every App

MMNMNOTE
markdown linksrelative pathobsidiangithubvs codemkdocsnew link formatportable notes

Write links between notes as paths relative to the note that holds them: ../Projects/Plan.md, not Projects/Plan.md. Obsidian reads a folder path from the vault root. GitHub, VS Code, MkDocs and a web browser read it from the note's own folder. In our test of four link forms, only the relative one reached the right file everywhere.

The question is old and still asked. "GitHub relative link in Markdown file," posted on Stack Overflow in October 2011, has more than 1.4 million views and a score of 1,616.1 On Obsidian's forum, a 2022 request to start vault paths with a leading slash has 5,373 views,2 and a thread titled "Internal links not working on Github?" has 2,795.3

Nobody in this story is broken. Each tool follows its own documented rule, and the rules disagree about one thing — the folder a path starts from.

It depends on who reads the file. Obsidian starts a folder path at the vault root. GitHub, VS Code, MkDocs and any web browser start it at the folder of the note that contains the link. A leading slash means a different root again in each — vault, repository, workspace, server or disk.

Where the note is readA plain path like Projects/Plan.md starts from…A leading / means…
Obsidian, inside the vaultthe vault rootthe vault root (the slash is dropped)
GitHub, repository viewthe note's own folderthe repository root
VS Code's Markdown toolsthe note's own folderthe workspace root
MkDocs, the built websitethe note's own folder (then adjusted for the page)left as is — the web server root
A browser, or any file opened from diskthe note's own folderthe server root or the root of the drive

Each row is written down by the tool itself. Obsidian's help page on internal links: "To link to a note in a folder, include the folder path before the note name. Folder paths start at the vault root and use forward slashes (/), even on Windows".4

GitHub's documentation on README files says the opposite about the starting point: "The path of the link will be relative to the current file. Links starting with / will be relative to the repository root. You can use all relative link operands, such as ./ and ../."5

VS Code's Markdown guide, in its section on path completions, agrees with GitHub — spelling slip included: "Paths starting with / are resolved relative to the current workspace root, while paths staring with ./ or without any prefix are resolved relative to the current file."6

MkDocs, which turns a folder of Markdown into a website, adds a warning: "Using absolute paths with links is not officially supported. Relative paths are adjusted by MkDocs to ensure they are always relative to the page. Absolute paths are not modified at all."7

GitHub, VS Code and MkDocs are not being odd. They follow the web's own rule for a path inside a link — RFC 3986, the standard that defines URLs:

"A relative reference that begins with a single slash character is termed an absolute-path reference. A relative reference that does not begin with a slash character is termed a relative-path reference."8

A relative-path reference is resolved against the location of the document that holds it — here, the note's folder.

Obsidian has its own convention inside the vault, and it documents it. One written path — two different files.

We put one note at Daily/2026-11-18.md and linked it to Projects/Plan.md in four ways. Then we checked each link as Obsidian reads it, as GitHub and VS Code document it, through a real MkDocs 1.6.1 build, and through a URL parser opening it from disk and from a website. Only ../Projects/Plan.md reached the file in every place.

Link as writtenObsidianGitHubVS CodeMkDocs buildOpened from diskWebsite in a sub-folder
[plan](Plan.md)opens (name is unique)missesmissesWARNINGmissesmisses
[plan](Projects/Plan.md)opensmissesmissesWARNINGmissesmisses
[plan](../Projects/Plan.md)opensopensopensresolvesopensopens
[plan](/Projects/Plan.md)opensopensopens (vault opened as the folder)INFO — left as ismisses (drive root)misses (drops the sub-folder)

The MkDocs build printed the misses itself. For the vault-root path it reported the folder it actually looked in:

WARNING -  Doc file 'Daily/2026-11-18.md' contains a link 'Projects/Plan.md', but the target 'Daily/Projects/Plan.md' is not found among documentation files.
INFO    -  Doc file 'Daily/2026-11-18.md' contains an absolute link '/Projects/Plan.md', it was left as is. Did you mean '../Projects/Plan.md'?

The two right-hand columns come from the URL parser in Node.js 20, which follows the browser standard. From file:///home/me/vault/Daily/2026-11-18.md, the plain path became file:///home/me/vault/Daily/Projects/Plan.md — a folder that does not exist. The leading slash became file:///Projects/Plan.md, at the root of the disk. Only ../Projects/Plan.md landed on file:///home/me/vault/Projects/Plan.md.

The website column used a site served from a sub-folder, https://u.github.io/vault/, with .md turned into .html. The leading slash produced https://u.github.io/Projects/Plan.html — the /vault/ part gone.

The GitHub column follows GitHub's documented rule, and a live repository shows it at work. In microsoft/vscode-docs, the file docs/languages/markdown.md links to /docs/editing/userdefinedsnippets.md, which GitHub renders as a link into that path from the repository root. The same file's images/Markdown/go-to-symbol.png renders under docs/languages/ — the file's own folder.9

An honest limit — we did not click these links inside Obsidian or push this vault to GitHub. The Obsidian column comes from the shipped app's code, below.

Why Obsidian opens all four

Obsidian's link reader is generous by design. In the 1.15.1 desktop app's code, a bare file name that is unique resolves anywhere in the vault, ./ and ../ resolve from the note's folder, a leading slash is dropped and the rest is read from the vault root, and any other folder path is tried from the vault root first.10

That generosity is why a link can look fine in the vault and still fail on GitHub. It also explains the default. The settings shipped in 1.15.1 set New link format to Shortest path when possible, with Wikilinks on.10

Ryan J. A. Murphy of the Obsidian team, relaying the developers' answer on the forum in 2021, explained what "shortest" means: "If the file name is unique, then it's just the filename. If it's not unique, then it's the absolute path from the vault root".11 Those are rows one and two of the table. Neither starts from the note's folder, so neither travels.

The leading slash was asked for and declined. WhiteNoise, of the Obsidian team, replied to the 2022 request: "A leading / also generally means “from the root of the filesystem” not “from the root of the vault”."2 The same reply said the change would break nested vaults, a reason restated in the thread a year later.

Inside one vault, these are sensible choices. They matter only when the same file is read somewhere else.

Two settings decide what Obsidian writes when you insert a link. Turn off Use [[Wikilinks]] so new links are Markdown links, then set New link format to Relative path to file. From then on, each link you insert starts from the note's own folder — the form GitHub, VS Code and a website all read the same way.

  1. Open Settings → Files and links.
  2. Turn off Use [[Wikilinks]]. Obsidian's help puts it plainly: "If interoperability is important to you, you can disable Wikilinks and use Markdown links instead."4 Why [text](path) outlives [[wikilinks]] is its own question — Write the Link Once, Read It Anywhere covers it.
  3. Set New link format to Relative path to file. Obsidian documents the three choices in one line each:12
    • Shortest path when possible — "Uses the shortest unique path to the linked file."
    • Relative path to file — "Uses a path relative to the current file."
    • Absolute path in vault — "Uses the full path from the vault root."
  4. Insert one test link from a note inside a folder to a note in a different folder. Read the raw text. It should begin with ../.
  5. Expect nothing else to change. The setting controls what Obsidian inserts from now on — links it auto-generates. Every link already in the vault keeps its old form.

"Absolute path in vault" sounds like the safe pick for Git. It is the second row of the table, and it missed in every place we checked outside Obsidian.

If you use a different notes app, look for a setting with the word "relative" in it. If there is none, open one note's raw text and compare its links to the table above.

Back up or commit the vault first. Then rewrite every link that starts from the vault root, or uses a bare file name, so that it starts from the note's folder instead. Run a dry run, read the list, write the changes, and run again — a second pass should change nothing. Finish with a check.

There are two documented routes. The Link Converter community plugin for Obsidian says in its README: "The plugin also helps you to convert final path to relative, absolute or shortest possible."13 We did not test it.

The second route is the short script below, which we did test. It needs Python 3 and nothing else.

  1. Back up. Commit the vault if it is a Git repository, or copy the whole folder somewhere else.
  2. Save the script as relink.py outside the vault.
  3. Dry run: python3 relink.py /path/to/vault. It prints each change and writes nothing.
  4. Read the list. Every line should point at the file you expect.
  5. Write: python3 relink.py /path/to/vault --write.
  6. Run the dry run again. It should print 0 link(s) would change.
  7. Check with VS Code or MkDocs, as in the next section.
#!/usr/bin/env python3
"""Rewrite vault-root / shortest-path Markdown links to paths relative to the note.
Usage: python3 relink.py <vault-dir> [--write]   (dry run by default)"""
import os, re, sys
from urllib.parse import unquote, quote

LINK = re.compile(r'(?<!!)\[([^\]]*)\]\(([^)\s]+)\)')

def main(vault, write):
    vault = os.path.abspath(vault)
    files = []
    for d, _, fs in os.walk(vault):
        if '/.' in d.replace(vault, ''):
            continue
        files += [os.path.relpath(os.path.join(d, f), vault) for f in fs]
    by_name = {}
    for f in files:
        by_name.setdefault(os.path.basename(f).lower(), []).append(f)
    changed = 0
    for note in [f for f in files if f.endswith('.md')]:
        path = os.path.join(vault, note)
        text = open(path, encoding='utf-8').read()
        def fix(m):
            nonlocal changed
            label, target = m.group(1), m.group(2)
            if re.match(r'^[a-z][a-z0-9+.-]*:', target, re.I) or target.startswith(('#', './', '../')):
                return m.group(0)
            raw, _, frag = target.partition('#')
            t = unquote(raw).lstrip('/')
            cands = [t] if t in files else ([] if '/' in t else by_name.get(t.lower(), []))
            if len(cands) != 1:
                return m.group(0)
            rel = os.path.relpath(cands[0], os.path.dirname(note) or '.')
            if rel == raw:
                return m.group(0)
            new = quote(rel, safe='/.-_~') + ('#' + frag if frag else '')
            print(f'{note}: ({target}) -> ({new})')
            changed += 1
            return f'[{label}]({new})'
        out = LINK.sub(fix, text)
        if write and out != text:
            open(path, 'w', encoding='utf-8').write(out)
    print(f'{changed} link(s) {"rewritten" if write else "would change"}')

if __name__ == '__main__':
    main(sys.argv[1], '--write' in sys.argv)

The script reads a link the way Obsidian does. A leading slash or a folder path counts from the vault root. A bare name means the one file with that name — and if two files share it, or none exists, the link is skipped. It keeps any #heading part, keeps spaces spelled %20 (the spelling trap A Space in the Note Name Breaks the Markdown Link explains), and ignores hidden folders such as .obsidian.

It leaves alone wikilinks, images and web addresses. It also skips links that already start with ./ or ../, and links whose target contains a space or a title — those need a hand.

We ran it on a test vault whose daily note held ten links. The dry run listed these five, and only these:

Daily/2026-11-18.md: (Plan.md) -> (../Projects/Plan.md)
Daily/2026-11-18.md: (Projects/Plan.md) -> (../Projects/Plan.md)
Daily/2026-11-18.md: (/Projects/Plan.md) -> (../Projects/Plan.md)
Daily/2026-11-18.md: (Projects/Plan.md#goals) -> (../Projects/Plan.md#goals)
Daily/2026-11-18.md: (Projects/Three%20laws.md) -> (../Projects/Three%20laws.md)
5 link(s) would change

The other five — an already-relative link, a bare name shared by two files, an image, a wikilink and a web address — stayed as they were. A second run changed nothing. One small vault is not every vault, which is why the backup and the dry run are steps, not suggestions.

Open the vault in a tool that reads links the way the outside world does, and let it list the failures. VS Code does this once link validation is on — it is off by default. An MkDocs build does it on every run, printing a WARNING for each link whose target it cannot find.

In VS Code, open the vault folder and add one line to your settings. The docs: "Link validation is off by default. To enable it, set "markdown.validate.enabled": true." Invalid links then show up "as either warnings or errors".6

With MkDocs, install it with pip install mkdocs, make a folder next to the vault, and put a two-line mkdocs.yml in it:

site_name: check
docs_dir: ../vault

Run mkdocs build in that folder and read the WARNING lines. Folders whose names start with a dot, such as .obsidian, are left out of the build.

In our test vault the build printed six WARNING lines and one INFO before the conversion. After it, two WARNING lines remained — the shared bare name and the image the script had deliberately skipped.

Only if everything that reads your notes treats the slash the same way, and few setups do. A leading slash opens the right file on GitHub, counted from the repository root, and in VS Code, counted from the workspace root. Opened from disk it points at the root of the drive; on a website, at the server root.

That last case catches people who publish a vault to a project site, where the site lives in a sub-folder such as https://u.github.io/vault/. A slash link jumps out of it to https://u.github.io/Projects/Plan.html. MkDocs says this directly: "This means that your links using absolute paths might work fine in your local environment but they might break once you deploy them to your production server."7

The demand is real — "Relative Link to Repo's Root from Markdown file," a Stack Overflow question from 2016, has 34,501 views.14 The answer works on GitHub — and stops working the moment the same files are read anywhere with a different root.

GitHub's documentation, in the same section, gives the general advice: "Absolute links may not work in clones of your repository - we recommend using relative links to refer to other files within your repository."5

A path from the note's folder is right only while the note stays in that folder. Move the note, and every relative link inside it needs rewriting. Obsidian has a setting to update links on rename, but users have reported since 2020 that relative links inside a moved note are not always rewritten.

The report is a forum thread opened by Obsidian staff in August 2020, "Broken links in relative path mode on move/rename". It is tagged repro and has 8,351 views and 86 likes.15 Its latest post, from April 2026, still asks for a fix: "Switching to relative markdown links addresses both — but only if this bug is fixed."15 We did not re-test it in 1.15.1.

VS Code does not help by default either. Its setting for updating links when a file moves ships as "never (the default) — Don't try to update links automatically."6

So keep the check from the previous section as a habit after any big reorganisation, and fix what it lists. Links between notes are fragile in every syntax — The Links Between Your Notes Aren't Plain Markdown makes that case for renames.

The trade is still worth it. A vault-root link is wrong outside the app all the time. A relative link is wrong only after a move — and a build tells you exactly where.

Common mistakes

Most broken links come from testing in one place and trusting the result everywhere. Obsidian opens all four forms, so a vault can look perfect while many of its links fail on GitHub. These are the usual traps, each with its fix.

Frequently Asked Questions

The questions below are the titles people used on Stack Overflow and on Obsidian's forum, most of them years old and still collecting views. Each answer gives the rule for where the path starts and the fix that works in GitHub, VS Code, Obsidian and on a website.

Two causes are common. Wikilinks like [[Plan]] are not standard Markdown, so GitHub shows them as text. And a Markdown link written from the vault root, such as Projects/Plan.md, is read by GitHub from the note's own folder. Switch to Markdown links and set Obsidian's New link format to Relative path to file.

GitHub reads a relative link from the folder of the file that contains it. To reach a file in a sibling folder, go up first: ../Projects/Plan.md. GitHub's documentation also allows ./ and ../, and treats a link starting with / as counted from the repository root.

Start the link with a slash — /docs/setup.md — and GitHub counts it from the repository root. VS Code counts it from the workspace root. The same link breaks when the file is opened from disk or published to a site in a sub-folder, so a ../ path is the safer choice for notes.

What is "Shortest path when possible"?

It is Obsidian's default New link format. If the target's file name is unique in the vault, Obsidian writes just the name, such as Plan.md. If not, it writes the full path from the vault root. Obsidian finds both forms. GitHub, VS Code and a website look for them in the note's own folder instead.

Obsidian offers three options. Shortest path writes a bare name when it is unique. Absolute path in vault writes the full path from the vault root. Relative path to file writes a path from the note's own folder, using ../ to go up. Only the relative form works outside Obsidian too.

Start absolute path (path from vault folder) with a leading slash /

Obsidian already reads a leading slash as the vault root, but it will not write one. Its staff declined the request in 2022, noting that a leading slash usually means the root of the filesystem. A slash link would also break from disk and on a website in a sub-folder.

Users have reported since 2020 that Obsidian does not always rewrite relative links inside a note that has been moved; the thread was still active in April 2026. After moving notes, run a check — VS Code link validation or an MkDocs build — and fix the links it lists.


A path is an instruction that starts somewhere. Write it from the one place every reader agrees on — the note itself.


MNMNOTE keeps notes in open Markdown, the plain text every tool in this post can read. mnmnote.com

Footnotes

  1. Stack Overflow, "GitHub relative link in Markdown file," question 7653483, asked 2011-10-04 (1,405,003 views, score 1,616 per the Stack Exchange API on 2026-11-18). https://stackoverflow.com/questions/7653483, accessed 2026-11-18. ↩

  2. Obsidian Forum, "Start absolute path (path from vault folder) with a leading slash /," topic 32501, opened 2022-02-15 (5,373 views, 23 posts); reply by WhiteNoise, post #2, 2022-02-15; reason restated in post #8, 2023-03-28. https://forum.obsidian.md/t/32501, accessed 2026-11-18. ↩ ↩2

  3. Obsidian Forum, "Internal links not working on Github?," topic 50058, opened 2022-12-19 (2,795 views). https://forum.obsidian.md/t/50058, accessed 2026-11-18. ↩

  4. Obsidian Help, "Internal links." https://obsidian.md/help/links, accessed 2026-11-18. Source text: https://github.com/obsidianmd/obsidian-help/blob/master/en/Linking%20notes%20and%20files/Internal%20links.md ↩ ↩2

  5. GitHub Docs, "About the repository README file," section "Relative links and image paths in Markdown files." https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes#relative-links-and-image-paths-in-markdown-files, accessed 2026-11-18. ↩ ↩2

  6. Visual Studio Code documentation, "Markdown and Visual Studio Code" (approved 2026-11-11). https://code.visualstudio.com/docs/languages/markdown, accessed 2026-11-18. ↩ ↩2 ↩3

  7. MkDocs, "Writing your docs," section "Linking to pages." https://www.mkdocs.org/user-guide/writing-your-docs/, accessed 2026-11-18. ↩ ↩2

  8. T. Berners-Lee, R. Fielding, L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax," RFC 3986 (STD 66), §4.2, IETF, January 2005. https://www.rfc-editor.org/rfc/rfc3986.txt, accessed 2026-11-18. ↩

  9. GitHub, rendered view of microsoft/vscode-docs, docs/languages/markdown.md (branch main). https://github.com/microsoft/vscode-docs/blob/main/docs/languages/markdown.md, accessed 2026-11-18. ↩

  10. Obsidian 1.15.1 desktop release, obsidian-1.15.1.asar.gz — default settings and link resolver as shipped, examined 2026-11-18. https://github.com/obsidianmd/obsidian-releases/releases/download/v1.15.1/obsidian-1.15.1.asar.gz ↩ ↩2

  11. Obsidian Forum, "Settings: New Link Format: What is "Shortest path when possible"?," topic 6748, post #5 by Ryan J. A. Murphy, 2021-01-27. https://forum.obsidian.md/t/6748/5, accessed 2026-11-18. ↩

  12. Obsidian Help, "Settings," Files and links → New link format. https://obsidian.md/help/settings, accessed 2026-11-18. ↩

  13. ozntel, "obsidian-link-converter," README. https://github.com/ozntel/obsidian-link-converter, accessed 2026-11-18. ↩

  14. Stack Overflow, "Relative Link to Repo's Root from Markdown file," question 40422790, asked 2016-11-04 (34,501 views per the Stack Exchange API on 2026-11-18). https://stackoverflow.com/questions/40422790, accessed 2026-11-18. ↩

  15. Obsidian Forum, "Broken links in relative path mode on move/rename," topic 4386, opened 2020-08-14 by Obsidian staff (8,351 views, 36 posts, 86 likes as of 2026-11-18); post #37 by archavan, 2026-04-02. https://forum.obsidian.md/t/4386, accessed 2026-11-18. ↩ ↩2