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.

13 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?

4 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.

3 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.

3 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!

2 Likes

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

1 Like

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?

The main benefit here is that ā€œCustom File Extension Pluginā€ allows you to select many/all types of files to view & edit directly in Obsidian, rather than just .txt or .csv.

2 Likes

Txt as MD allows that too.

As far as I and it seems other can tell: It does not.

Can you explain and maybe provide a screenshot or two?

Itā€™s been mentioned elsewhere too

In the post you linked it is said that one can add other extensions by editing the main.js file. This is not a viable option for many users.

The Custom File Extension plugin allows you to do that using settings and a JSON object.

Finally, the plaintext plugin allows for extra extensions to be added in a comma separated list in the settings.

The final two are understandable for most people and somewhat easy, whilst the first is not.

The middle one is also maintained recently, whilst the other two not so much. Not sure why, but Iā€™m still using the plaintext variant.

1 Like

Ease is one thing, extra features were my question. Asked because new plugins appear often without explanation of how they differ from existing plugins. The answer was that txt as md doesnā€™t allow any plaintext extension which is incorrect.

Maintenance isnā€™t necessary when plugins still work as intended. Another way of judging plugins is by the reputation of the developer.

Sorry, you can open any file in Obsidian.

Preferences > files & links > detect all file types