Can I teach DevonThink about new file types?

I recently started indexing a folder for a new project – writing a bunch of YAML schema. DevonThink keeps writing unknown file type messages in the log. Is there any way to make DevonThink understand that these are just plain old text files? I am not looking for syntax coloring or anything like that (BBedit and VCS do that for me), but when I select that file in DT it shows a bit BBEDIT icon :). I would just like to see the text.

1 Like

I’d guess that you see the icon because you have set BBedit as default app for YAML files. As to making DT recognize them as text files: You might want to try using a smart rule for that. I didn’t test it, though:

  • Select names ending with “yaml” (the “suffix” selection does not work here because it is a canned list that doen’t contain YAML)
  • Set the action to “convert to text”.
    You could try that with a copy of a document and run the rule manually to see if it works.
1 Like

Won’t that create another document?

I don’t know whether it works for your records but you could try the hidden preference AdditionalPlainTextExtensions. Search for this or „hidden preference“ in DEVONthink‘s help.

2 Likes

Brilliant idea – didnt know that that pref existed. But alas, it doesn’t do it. I set them up:

defaults write com.devon-technologies.think3 AdditionalPlainTextExtensions -string .json.yaml.yml
defaults read com.devon-technologies.think3 AdditionalPlainTextExtensions
.json.yaml.yml

And then restarted DT… But I still just get the big BBEDIT icon.
Thanks though.

You’d need to set a different system default application for those file types if you want the icon to change.

i dont want the icon to change – i want to see the text :slight_smile:

DEVONthink uses Apple’s QuickLook technology for such previews. You’d need to look for and install an appropriate QuickLook plugin on your Mac, if one exists.

Ah… OK… I had installed the appropriate Quicklook plugin for Mojave, but haven’t found one yet for BigSur. Need to keep looking. Thanks – that gives me a target to shoot for.

You’re welcome.

Got it working.

A pointer to the quick look plugin or so might be helpful for posteriority, I think.

It was a few steps. I was going to try to document it.

I started by downloading QLStephen.qlgenerator. The one I found was version 1.4.3 (more on this a bit farther down). I put this (after unzipping) into ~/Library/Quicklook. Nothing happened.

Two commands you need to know about:

xattr -d -r com.apple.quarantine ~/Library/QuickLook

This command will unquarantine the extension if you get the Apple error message about unknown developer, etc.

qlmanage -r

This commands restarts Quicklook and re-reads all of the plugins.

But it still didn’t work. (I think this worked for under Mojave). Then I found a note somewhere that you need to edit the Info.plist (inside the package) to add the value public.yaml to the LSItemsContentTypes key. So it looks like:

LSItemContentTypes

public.data
public.yaml. (this line wasnt there until i put it there)

Now I did qlmanage -r and voila quicklook worked on my .yaml file and then I tried DevonThink and it displayed as a text file there also.

As noted above, I downloaded version 1.4.3 because it was the first one that I found. Later on I found 1.5.1 in Github and I figured that it would “just work”. It didn’t “just work” so I backed down to 1.4.3. I probably could have gotten working with some more reading and playing and it likely fixes some bugs, but I am where I need to be for now, so maybe another day.

3 Likes

Thanks for the info!

Hi Christian @cgrunenberg, is there a way to edit YAML files in DEVONthink? I tried adding it to AdditionalPlainTextExtensions, but that doesn’t make it editable. It’s just plain text, so I think it shouldn’t be a problem.

You might have to reimport the files or rebuild the database.

1 Like

Wonderful. Works perfectly now. Thanks, Chris.