Have Obsidian be the handler of .md files / Add ability to use Obsidian as a markdown editor on files outside vault (file association)

Use case or problem

When I set *.md files in gnome to open in obsidian, it simply doesn’t open that file. This includes markdown files that are within the vault (so the full path is known). If obsidian is already opened, it has different behavior by opening the launch screen, not even the open app.

GNOME version: 43.6
OS: Debian GNU/Linux 12 (bookworm)

Proposed solution

Open the markdown file in obsidian. (Particularly when the file is already within the vault).

Current workaround (optional)

Don’t associate obsidian as what markdown files open with

Related feature requests (optional)

Similar request:

1 Like

A standalone Obsidian markdown editor would be excellent, naysayers be damned. +1


uh since my request got merged into this one, I’m going to clarify that opening ANY markdown file even files within the vault folder… does not open that markdown file using GNOME. It just opens obsidian in whatever prior context it was regardless of the file selected.

simply opening a new tab of the markdown requested would be better behavior.


This is a very fascinating discussion. I think obsidian should eventually implement this natively, where if it can resolve the file to a vault, it opens the file within the vault, else it opens in a vault-less mode that allows editing or previewing of the individual file. Code editors like sublime and vscode have “project” views and “file” views, and are smart enough to display one or the other depending on what you open in them.

In obsidian’s defense, code editors generally allow you to configure plugins system wide (and thus they are available while editing individual files) whereas obsidian’s plugins are on a per-vault basis. Users with lots of plugins would get a severely limited experience when opening a vaultless file, since there is no global or default plugin configuration for obsidian to fall back to. This makes this request a unique user experience problem that doesn’t have a perfectly analogous solution that the obsidian developers can follow.

In the meantime: I really liked some of the above suggestions. On macOS a separate “markdown opener” application that could be used as the handler for all md files, or a quick action that could be used as an alternate to opening the markdown file seem like the next best solution. As others have stated the logic in either case would be (1) if the note is part of an obsidian vault, open with obsidian url handler or (2) open with a default editor if not

I figured out a way to create an application on macOS that can do exactly this, now when I double click a markdown file it will either open in obsidian or sublime text. Instructions for Sublime text below. If you wish to use another application (such as TextEdit), just replace the “Sublime Text” with the name of the text editor you want to use before saving your Automator application.


  1. Open Automator:
    • Navigate to your Applications folder and open Automator.
  2. Create a New Application:
    • In Automator, choose to create a new Application.
  3. Add a Run Shell Script Action:
    • In the search bar at the top left, type “Run Shell Script” to find the action.
    • Drag the “Run Shell Script” action to the workflow area on the right.
  4. Configure the Shell Script Action:
    • In the “Run Shell Script” action, you’ll see a text area where you can write your bash script.
    • Set the Shell to /bin/bash.
    • Set Pass input to as arguments.
    • Copy and paste the below bash script into the text area provided.
# For each file that we are passed
for f in "$@"
    # start at the folder the file is in
    dir=$(dirname "$f")
    # while we are not at the root of the hard drive
    while [ "$dir" != "/" ]; do
        # check to see if we have reached an obsidian vault
        if [ -d "$dir/.obsidian" ]; then
            # If we have, open in obsidian
            open "obsidian://open?vault=$(basename "$dir")&file=${f#$dir/}"
        # go up one folder to se if we are in an obsidian vault
        dir=$(dirname "$dir")
    # if we get this far, then we reached the root of the hard drive, and did not find an obsidian vault
    # Fallback to Sublime Text
    open -a "Sublime Text" "$f"
  1. Save the Automator Application:
    • Go to File > Save or press Command-S.
    • Save the Automator Application in your Applications folder with a suitable name (e.g., MarkdownHandler.app).
  2. Set the Automator Application as the Default Handler:
    • Find a .md file in Finder and right-click it.
    • Choose Get Info.
    • Expand the Open with: section.
    • Click the dropdown and choose Other....
    • Navigate to and select your Automator Application (MarkdownHandler.app).
    • Click Add.
    • Click Change All... to set this application as the default for all .md files.

Now, whenever you open a markdown file, it will be processed by the inline script in your Automator Application and opened in the file’s containing obsidian vault whenever possible, or your fallback application otherwise.


Fallback editors I’ve tested the above script with:

- Sublime Text
- TextEdit
- iA Writer
- Visual Studio Code
1 Like

You sir, are the grand master! :raised_hands:
Works like a charm and I truly appreciate you sharing this.
I don’t know if something like this could be used by the developers of Obsidian to workaround the issues some people mentioned here. I’m not a developer myself, so whatever others were trying to explain on why Obsidian can’t open the .md files, goes over my head 100%.

Anyway, just wanted to thank you for sharing this :muscle:

The .md files now have a different icon based on the MarkdownHandler.app

I was able to change this by changing the .icns file inside the MarkdownHandler.app (Right click > Show Package Contents > Contents > Resources > AutomatorApplet.icns).
I delete that file and copied the one inside Obsidian.app and put it in that same Resources folder.
I kept the name “AutomatorApplet.icns” just in case, because I don’t know if that would make a difference or not.
And now all my files open using your script, and have the Obsidian icon:



There’s a feature request to rectify that here: Global Settings / Same settings, themes, and plugins across multiple vaults

Without that, or at least an option to choose a primary vault and use its settings and plugins, the ability to use Obsidian as a markdown editor for files system-wide would be almost pointless.

1 Like

Thank you! Thank you! Thank you!

I was looking for something exactly like this and I will promote it.

And it works with MarkEdit ( GitHub - MarkEdit-app/MarkEdit: Just like TextEdit on Mac but dedicated to Markdown. ) as well.

It works perfectly out-of-the-box on Windows 11. Thanks!

1 Like

oh, great!
We could probably make a mac OS shortcut out of it.
It would be even easier to set up: just a download link and install…

not sure I can make it myself, but I might give it a try in the next days…