Can this be done with Drafts 5?

Hello people excited to be on this forum. I hope to learn a lot tips and best practices.

I’m looking for a solution to this:

I’m in a note, any note, and I select text, it can be a word or multiple words, and I copy it via the Norma copy paste menu or if Drafts 5 has its own.

Then paste it on the same note, just further down for example, a few return keys presses, but now the text has the following format:

{{c1::Myocardial Infarction}}

So my original text was: Myocardial Infarction

I selected it, copied it, and re pasted but with the formatting above.

Any help on this would be epic. Thanks!!!

Fingers crossed,

Why I’m using it: I’m using it to format question I do my iPhone or iPad to make flash cards to Anki, a software used for space repetition learning.

1 Like

I’m not sure I quite followed that, but here’s my first guess at something that might help.

This action takes the currently selected text and replaces it with the currently selected text, followed by three new lines, followed by the selection wrapped in the format you showed above.

The action does not require the use of the clipboard, and so should have fewer steps; but still match the result I think you have described. It consists of a single insert text action step.

The screenshots below show what happens when run against a selection.

If the content was in amongst other text, this probably would not work as desired, but the principle remains and you could then tailor the insertion content and utilise the [[clipboard]] instead of [[selection]].

Thanks so much I was able to modify and it works like a charm now. I need to learn how to post to the forum for other possible members to benefit from it.

Thanks for pointing the way.

How do you import this into the Anki app on the ipad? If you can explain in detail the EXACT steps, it would be very helpful

This part is manual. I basically create the Cloze entries here and then copy and paste to Anki add screen side by side and its pretty fast.

Thanks. Let me try it your way. Hitherto I was typing it out in the Anki App on IOS. Are you using the Anki IOS App or the desktop version?

You can definitely add them to Anki on iOS from drafts using URL schemes:

Thanks a ton. Can you give me a live example, I’m not a coder, but if you can just point at how how I should get started, I will be able to figure it out. So, I have the front and back of the card ready in Drafts, then what? Where do I copy the URL for this Draft? Do I have to make a separate draft for each card?

So Drafts has an action step for creating a callback url, which is where you can define a template for sending Drafts text to Anki.

You’d want the URL to look something like this:


The [[title]] and [[body]] parts are where you can customize. These say: make the front of the card the first line of the draft and make the back of the card the rest of the lines of the draft.

You can customize this somewhat if you like. For example, maybe you want the whole draft on the back of the card and you want to be prompted to write the front of the card when you fire the action. Just add a prompt step before the Callback url. Make sure to add the “text field” to the prompt. Then your url would look like this:


Don’t forget, for all of these URLs you need to change the “UserName” and “Default” (deck name) to whatever you’re using in Anki.

Thanks for sharing this template. Based on your previous link I could get this to work reliably:



But I have to paste in safari and go thru that whole process. Super slow

In your example you have [[title]] and [[body]]. Can these be any number of characters. Ie. “This is my Title because I need to have questions as titles” can I bracket this whole statement as title.

Also can I limit the body to some point. Meaning the first few sentence of the body. But below this I have more notes. But these don’t go. Oops I think I answered my own question. As long as the body is double bracketed it will be fine. It won’t grab the text below. Am I correct?

Now, this action in drafts that will hold this template. How does it look like in action. Can you elaborated this a bit more. Thank you so much. I guess this doesn’t work on the Drafts desktop component only iOS. Is that true.

Template tags, the double bracketed parameters, are special place holders that Drafts will substitute content into.

Read this page in the documentation.

Note if these tags are being passed in URLS, the content should also be set to be URL encoded.

1 Like

I think you may be missing a step. The URL is not something to paste into Safari. Instead, you want to create an action in Drafts–look at the support documents I linked to in my post. So, what you would do is this:

  1. Create the action following the guidelines in the Drafts support documents.
  2. Type what you want on the front of the card in the first line of the Draft.
  3. Type what you want on the back of the card in the rest of the Draft. This can be as many lines as you want.
  4. Open the Drafts actions panel (on the right)
  5. Choose the action you created.

Drafts will then open Anki and create the card.

1 Like

Ok thanks I’ll try to wrestle with step 0 and report back, creating the action will be the most difficult step for me.

I so appreciate it. If I can get this work it will be a game changer. Let’s get to tinkering, gotta love Drafts

This might help

Thanks so much it worked like a charm !!! I will have to check tomorrow morning if it will work from the desktop version of Drafts 5 as well but on iOS it’s amazing.

Here’s my action:


I might try to add Tags as well. In my case it will be same Tag.

Triple thanks for all your help. Here’s the visual part which may help some folks too. Notice how I added to the title the space HTML code because the it wouldn’t pass in the url saved in the action. I like my close returns ANKI to look like this.

1 Like

Sorry, I am still at sea. My Deck is called ‘Stock Market Learning’ and my action looks like

profile=Stock Market Learning=Basic&deck=Default&fldFront=[[title]]&fldBack=[[body]]

It gives an error.

Surely you’d need to URL-encode those values?

profile=Stock Market Learning=Basic&deck=Default&fldFront={{[[title]]}}&fldBack={{[[body]]}}

I am doing a test card, so the name of my deck is Stock Market Learning and this is the action that I just scripted

profile=User 1&type=Basic&deck=Stock Market Learning&fldFront=front text&fldback=back text

And the draft that I have made on which this has to be run, does it have to be scripted as well? Mine looks lies this

What is the stock market?

It aggregates votes

I just changed my action to

profile=User 1&type=Basic&deck=Stock Market Learning&fldFront={{[[title]]}} &fldback={{[[body]]}}

and my card looks like this

[[Front]]What is the stock market?

[[Body]]It aggregates votes

It gives an error that says

“Invalid URL is generated by Callback URL step template”

As I mentioned earlier in the thread, and Matt mentioned today, look at URL encoding your content.

Spaces would be encoded into a URL as %20 for example, and I can see several spaces in your current URL.

Often the best way to debug is to start with a simplified URL you can put into Safari and have work. Then build on that.