How to just view non-markdown files and open it?

Is there a way to just view non-markdown files within Obsidian? Let me explain …

I have a folder with a bunch of markdown files, shell scripts, and images. Images and markdown files open beautifully in Obsidian. It would be great if I can just open to view the shell scripts too.

By default, I do not see the file types other than .md and .jpg|.png|... in the file hierarchy in the sidebar. I see there is an option under Settings > Files & Links > Detect all file extensions, which when enabled shows all files in the folder in the sidebar. The problem is when I click on them it opens in the default app. For shell scripts the default app would be terminal (at least on my machine).

I would like to just view the shell script(s) within Obsidian instead of opening it in the terminal every time I click on it (sometimes accidentally).

Is it possible to achieve this behavior?


Obsidian recognizes the following file formats:

  1. Markdown files: md
  2. Image files: png, webp, jpg, jpeg, gif, bmp, svg
  3. Audio files: mp3, webm, wav, m4a, ogg, 3gp, flac
  4. Video files: mp4, webm, ogv, mov, mkv
  5. PDF files: pdf

Anything else, by default, will open in another app. There’s an older plugin that still works to view and edit .txt files:

There may be others to read different file types. Have a look around in Community plugins.

1 Like

That is a nice one. Doesn’t work the way I am expecting. What happens is that the content of the file is considered markdown. So any comments in the shell scripts are rendered as heading 1. Other things are considered as latex formula. etc. etc.

I am not familiar with the plugin model nor the way Obsidian handles editing but I would be great to have this plugin extend to plain text editing.

Quick look at the plugin code looks like it is asking Obsidian to treat a .txt file as .md. I wish Obsidian provides support for editing text (or text-based files).

You can find a few threads on this topic: Search results for 'open txt files in obsidian' - Obsidian Forum

There is this plugin that does txt files. I don’t know if it can be configured for other filetypes. GitHub - deathau/txt-as-md-obsidian: Edit txt files in as if they were markdown

And then there is this open plugins idea thread. Allow Opening and Editing of any plain text file in Obsidian which may have some other suggestions and workarounds.

1 Like

This one seems promising but simple raw text editing. Nothing fancy like syntax highlighting and such.

obsidian-code-files is noteworthy but has the downside of dealing with a hosted version of the editor that means your stuff is sent to a third-party?

P.S: Leaving these links for posterity

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.