How can I use URLs in DT3 to add Markdown documents?

Hi there

How can I use URLs in DT3 on the Mac to add Markdown documents?

Via the Drafts app I tried

x-devonthink://createMarkdown?title=[[title]]&location=''&text=[[body]]

In DT3 I get instead of a Markdown document an empty entry of kind “internet location”. From my understanding the same URL works correctly on iOS.

What do I (or Drafts) do wrong?

Thanks for any pointers.

X-callback URLs on the Mac are very limited and basically only intended for clipping (e.g. bookmarklets). AppleScript & smart rules are recommended for automation usually. Anyway, could you please post the complete URL you tried?

X-callback URLs for moving DRAFTS 5 documents on a Mac to DT3 is definitely not going to work for you.

There are two pretty easy means of adding a DRAFTS 5 document to DT3.

[1] Using the new Sorter

x-devonthink://note?title=[[title]]&text=[[line|2..]]&tags=[[tags]]

This single step action (URL using this template) will open the DT3 Notetaker
The parameters are filled in automatically based on whatever is the foremost / presented draft on which the action is invoked.
The body of the drafts is automatically filled in correctly (and, of course, you have the option of editing the content before sending it into DT3)
The title of the DT3 file is exactly that of the draft.
Any tags associcated with the originating draft are added to the document that gets saved in DT3.
You have the choice of format (plain text, rich text, formatted, or markdown)
You have the choice of location (database and group) in which the resulting document is stored.

[2] Targeted Group

x-devonthink://createMarkdown?title=[[title]]&text=[[body]]&tags=[[tags]]&destination=9E54D865-BF18-4ECD-AF04-802BFE34AC13-17033-00000BDBA96C975F

This single step action in DRAFTS will take the foremost draft and send it to a specific group within a specific DT3 database. To obtain the UUID of the target group, within DT3 by copying the item link of the target group, which will place in your clipboard something like this.

x-devonthink-item://9E54D865-BF18-4ECD-AF04-802BFE34AC13-17033-00000BDBA96C975F

The UUID is the alphanumeric string that follows the double slash. Copy that into the URL above. This URL works very well, and can be incorporated into a more complex action script in which you’ve created a list of Groups to which you want to save drafts on a regular basis.

  • Rich

Thanks for the replies! :slight_smile:

@cgrunenberg An actual sample URL is:

x-devonthink://createmarkdown?title=Lewis%20Fry%20Richardson%20-%20Interesting%20scientist&location=%27%27&text=Lewis%20Fry%20Richardson%20-%20Interesting%20scientist%0A%0A%2A%20Weather%20predictions%20%0A%2A%20Source%3A%20Smith%20Journal%20Spring%2019

On iOS I get in the Inbox a Markdown document with title Lewis Fry Richardson - Interesting scientist and content

Lewis Fry Richardson - Interesting scientist

* Weather predictions 
* Source: Smith Journal Spring 19

I was hoping to get the same on macOS in DT3…


PS for @rmiller7: I don’t need the sorter I just want to send the stuff to the Global inbox. Do I really have to set an explicit location/destination for this?

The location parameter is invalid, the link works as expected after removing it.

Thanks a lot @cgrunenberg - this exactly was problem!

I’ll try whether the URL without the location parameter works on iOS as well - which would be terrific! :slight_smile:

The location parameter is optional.
As noted in the documentation (and it is in both DEVONthink and DEVONthink To Go’s), the location is an associated URL for the file, e.g., adding https://www.devontechnologies.com as a location for the user manual you imported.

@BLUEFROG The location parameter might be optional, but when it is set on macOS like this:

x-devonthink://createmarkdown?title=Lewis%20Fry%20Richardson%20-%20Interesting%20scientist&location=%27%27&text=Lewis%20Fry%20Richardson%20-%20Interesting%20scientist%0A%0A%2A%20Weather%20predictions%20%0A%2A%20Source%3A%20Smith%20Journal%20Spring%2019

it does not give a proper Markdown document with the location set to ‘’. Try it!

@cgrunenberg and all: Anyway my problem is solved: When I get rid of the location parameter the action works on both macOS and iOS like a charm. :slight_smile:

I didn’t mean you can set it to a null value. It must be set to some valid value.
It’s optional as in, don’t include it unless it’s needed.

@cgrunenberg

If a location parameter is included, it will download content from the specified URL as the text of the generated file.

x-devonthink://createMarkdown?title=Testing&ttext=This%20is%20a%20Markdown%20document.&location=https%3A%2F%2Fwww.devontechnologies.com

yields this, noting the URL is applied but the text is ignored…

Ooooooooooooooh, I see! The location is used to download the content, not just to set the URL field of the document! Then it makes sense that location='’ does not work!

Thanks for the (patient!) clarification.

By default it’s the bookmarklet to capture Markdown, only without a location and by specifying the text a Markdown document can be directly created.