Support txt and other files, and handle them just as Markdown

This has been requested before: Handle (edit) other plain text file formats ( rmarkdown, tex, txt, code, etc )

The suggestion to use the txt-as-md plugin does not work too well: Interlinks between files don’t quite work, the graph does not work, etc.

The main argument made in that forum post is also valid for me, i.e.: Interop with other tools, like Dokuwiki, nvAlt, whatever

I can also add a few more reasons, like:

  • For me, txt as file extension makes more sense, as it describes the content. You can argue the file extension should only describe the format and not the content, but I disagree.

  • If it is about the format: Even md is not really well defined. There are so many variations such that Obsidian markdown files might not fully work work in other tools and vice versa. So, md is more like saying “Markdown-like”. This could also be heuristically detected based on multiple features like file extension but also content.

  • You can argue as you want, in the end you can just leave it to the user. I don’t see why this must be restricted. Regarding technical reasons, see below. But this would be a separate discussion. I’m happy to help here if needed.

With my argument that the file extension is not so much about the format (at least for txt) or that the format is not so well defined (md), I see the support for no file extension as equal: Support for files without extensions

With this reasoning, I don’t think it makes sense to handle each file extension as different feature requests. It’s a single feature I want here: Configuring the current Markdown support to handle multiple file extensions.

So, my idea would be that the user can define a list of file extensions, which are all handled the same, as Markdown files are currently handled. E.g. for me it would be:

  • md, markdown etc
  • txt, text
  • no extension

Note that the order can be relevant. E.g. it can define priority. And new notes would automatically use the first defined extension.

Technical problems and solutions:

  • File names must be unique (e.g. for links). When there are multiple files with same name but different extensions: Just use the first (given the extension order) and ignore the others. Maybe show a little warning somewhere. This solution is very simple but also very much good enough, so I don’t really see a problem.

  • A new Markdown note is created: Use the first extension from the list.

  • I don’t know about any other technical problem.

1 Like

Agree in general, but I have discovered one advantage of the .md only approach - I can click in a file in the OS file explorer, or Canvas, and have it open in default program (Tangent in my case). Doesn’t help in Obsidian, but does if you use a different markdown editor. I’d prefer not to have a markdown editor as default for .txt.

While I agree that this should be built into Obsidian directly, there is a plugin that allows this, though you do have to manually specify each file type you want to open with Obsidian:

Obsidian Plaintext: https://github.com/dbarenholz/obsidian-plaintext

Doesn’t this only allow editing?
ie no graph etc

By default, yes. But there are standard options to enable both of those.

Enable:

  • Settings → Files & Links → Detect all file extensions.
  • Graph → Filters → Attachments

Those settings don’t confer the same functionality as .md files.

It will link to files and show backlinks from .md files. But the files it links to don’t show it in their backlinks.
And nor does it appear in the graph.

And if you drag a .txt file to a canvas, it shows without text.