Mostly reformulating the post above↑
Expected behavior when Obsidian is set as default app for “.md” files:
When Obsidian receives request to open “a/path/to/<filename.md>
”,
Climb up the folder hierarchy and check for existence of sibling folder named “.obsidian”.
When found, open corresponding vault. This will find innermost vault when nested vaults are being used.
current_folder := "a/path/to" // path to file
Loop{
- If current_folder has direct subfolder ".obsidian":
- open obsidian://vault/<current_folder>/<filename.md>
- return
- Else If current_folder has parent folder:
- current_folder := parent folder of current_folder
- Else:
- Display dialogue with options:
- open just in markdown editor without vault (default)
- select which folder from the path to transform into vault
- move the file into existing vault
- Display dialogue with options:
- select one of existing vaults, recently open vault being default
- cancel
- return
- cancel
- return
}