Allow Opening and Editing of any plain text file in Obsidian

Use case or problem

Obsidian states it allows you to work in a plain text filesystem:

This is not true, as obsidian ONLY supports markdown files, and on top of that, Obsidian has the unique requirement of the markdown file having an .md extension, which is not required by the standard, most programs, or filesystems.

Not only does obsidian require specially decorated files just for it (not plain text as it claims), but if it is a plain text, or markdown file, and the extension is incorrect, obsidian refuses to open them.

I can see in the obsidian API itself where it could allow for more file types. I’m just confused why a plain text editor can’t edit plain text.

Proposed solution

Allow any file that is encoded in plain text to be opened in Obsidian for editing just like a .md file; or provide an option to list the allowed extensions to display as opposed to limiting it to just .MD

Current workaround (optional)

The current workaround involves not using obsidian at all to open any file in your vault that is not .md (even though obsidian’s features include files that you need to edit that are not .md files [.css/.js]).

This workaround does not always work, as obsidian sync does not seem to track edits in other apps as well. With my own tests I have found that editing a .js file in my vault in another app, then opening obsidian has the potential to revert or delete the .js file without ever recording it’s history in the changelog. This is very bad for an app focused on recording information.

Another workaround would be to make a custom plugin, but a custom plugin and exiting safe mode just to edit to text files with a text editor seems like a step a lot of base level users wouldn’t want just to use the already built in features of obsidian.

5 Likes

Good point about the misleading marketing wording.

Check out GitHub - dbarenholz/obsidian-plaintext: Adds support for plaintext editing into obsidian. My own purpose is to edit .bib files directly, but surely others can find reasons to use it.

3 Likes

Thanks for the reply @obsequious.
I have in fact seen that plugin, but as I addressed in my post above, asking someone to exit safe mode to edit a text file in a text editor seems like a shot in the foot to obsidian itself.

Also, I’m in the process of learning how to edit plugins myself so I can update the plugin you’ve posted as we speak. Saddly it only works for pure text files unless you edit the plugin too yourself using… an exteral text editor lol.

I don’t think it’s a good solution to ask someone to download a plugin and edit the js in it manually then re-load obsidian to edit files that the editor could otherwise manage with a one line code change and has been claiming to manage in marketing for a long time right?

2 Likes

While I completely agree that this should be a built-in feature, I’ve found the following (partial) workaround.

The plugin Txt as md allows you to open and edit .txt files directly in Obsidian. I’ve hacked it a bit, and created Obsidian_Plugin-CSV_as_MD for doing the same with .csv files.

I haven’t played with Obsidian plugins before at all, but hope to expand the latter to allow people to specify a list of file extensions that Obsidian will register to open for editing as native, though this would necessarily be limited to plaintext files, and I have no timeline for this at all.

2 Likes

It’s worth pointing out that, while this allows other plaintext files to be read and edited, it does not make them functionally equivalent to .md in Obsidian. Which is limiting.

2 Likes

This is my first attempt at a plugin:

I still hope this is only needed temporarily. I would prefer this is added as a core functionality.

Thanks, @Meeps!

Looking forward to being able to use this!

Just wanted to add another vote for this. In particular, it’d be nice to be able to open JS files in a “scripts” folder that Templater users right in Obsidian, but the general case for any file extension that contains typically text files would be ideal.

4 Likes

None of the plugins listed here actually work. They are limited. It would have been really nice if Obsidian supports other plain text variants.

1 Like

I’m managing a lot xml so I’m in the same case. I found this plugin : plaintext which allow me to do this. With it you can edit all xml like md files.

@Dellu @crabtronic my plugin is now published and should work… sadly it hasn’t been added to the base product but I hope this works for your needs!

Sorry forgot to let you know it was all ready too!
cc @drventure @cwhiii

What does your plugin do that txt as md doesn’t?

You can use it to view and edit any plaintext file extension you add to its list, but Obsidian still doesn’t treat those files as equivalent to .md. Does your plugin do more that that?