"New with Clipboard' doesn't create Markdown text?

I have a Markdown document that I am chopping up into several smaller documents within DT. I select some text, cut it, then select “new from clipboard” from DT. It creates a plain text file, rather than a Markdown file. I know that, in essence, these are the same kinds of things. However, in DT, one can “preview” a markdown file, but not a “plain text” file. Is this something that can be addressed, or am I using the wrong procedure?

Thanks,
Derek

If you rename the file created with New With Clipboard by adding an .md or .markdown extension, all will be well. The problem DEVONthink probably faces is that it easy to determine if the clipboard contents is rich text, or an image, or sound, etc., but not to sort out what kind of plain text is on the clipboard. E.g. if you copy html and use New With Clipboard you get a new Text file, also. The clipboard doesn’t tell DEVONthink the source of the clipping, either.

Ah, thanks for the tip.

Would hope in the future for the developers to make some better way of addressing this issue, to avoid needing to append file extensions to markdown files to make them preview, or automate the addition of this extension somehow in some use cases.

I’m not sure your request would be a good target for the developers. Currently, when you select text and copy it to the clipboard, then save the clipboard contents, DEVONthink implements these actions by calls to OS X, without having to do any development. Those calls produce predictable results in the OS X environment. OS X will “recognize” the selected content as plain text, RTF or RTFD and assign the appropriate filetype extension. If you copy a selection from a Markdown file to the clipboard and save the clipboard contents as a new file, OS X will assign the plain text filetype extension to it.

As you know that you want those new files to have the Markdown extension, it’s a simple matter to save and rename them in the Finder and capture them to DEVONthink as Markdown files. If you rename plain text files already captured in DEVONthink with a different filetype extension and save them within DEVONthink, they will become Orphan files, and will have to be refiled into a DEVONthink database (and the original plain text files will still be there, unless deleted).

I suppose the developers could rewrite DEVONthink code to do what you request, but that isn’t very likely.

If you are using DEVONthink Pro or Pro Office, which are scriptable, perhaps a script could be written to perform the chores you need on a selected set of files. If you are using DEVONthink Personal (which isn’t scriptable), scripts operating outside the DEVONthink Personal environment can be written. Scripts can often automate defined procedures without requiring any change in DEVONthink itself. The Scripting section of the user forum is a lively venue for discussion of scripting approaches for many and varied purposes.

I don’t think I’d want DEVONthink deciding a text file is a markdown file merely because the text included asterisks, or hashmarks, or other characters that have ambiguous meaning – as Markdown signifiers and not-Markdown just plain old text. It’s a devilishly difficult thing to code this sort of file-type detector, and in this case it will fail frequently because of the built-in ambiguity that the code can never entirely resolve.

OTOH, there’s already a built-in script (Scripts > Rename > Add Suffix…) that adds any suffix you desire (e.g., .markdown) to as many files as you select. Takes a second to rename a hundred files with the correct extension.

thanks for the tip about the script Korm. That will be useful–hooked up to Keyboard Maestro or something like that it should be as seamless as something baked into DT itself.

There’s a hidden preference to enable rendering of all plain text files as Markdown:

x-devonthink://preference?key=PlainTextIsMarkdown&value=yes

BTW:
All other hidden preferences are listed in the documentation.

1 Like