Newbie question

I picked up a copy of Drafts this morning as a note replacement on my iPad. I like the ‘ease of use’ part a lot, but I may be doing something wrong.

I want to store the note I’ve written in Dropbox. I can sync with Dropbox easily enough, but the stored note looks to be Base64 encoded, and that’s the last thing I want. How do I store the raw text that I typed?

As I said, a simple thing that I may well have missed, but for me it’s a vital part of being a true notes replacement.

Thanks.

Which version of Drafts are you using. Drafts 4 or Drafts 5?

Drafts ships with a couple of example actions that work with Dropbox in the “Basic” action group - “Save to Dropbox” and “Append to Dropbox Journal” that should be good examples to get your started.

FYI: Drafts does not sync with Dropbox. It uses iCloud. Nothing is saved to Dropbox unless you explicit run an action to save it. Details on Sync.

Version 5.9, the latest available in the Apple App Store

You’re right about sync - my bad, I used the wrong term.

I’ve found and used the “Save to Dropbox” and “Append to Dropbox Journal” options, but I’m still getting Base-64 encoding. I’m sure everyone else doesn’t get this, so what am I missing?

Here’s a shortened example of what I’m trying to do:

{{{data
articleNo ; title
1 ; This is the first article
2 ; This is the second
}}}

What I see in the Dropbox file is:

 %7Bdata%0A%20%20%20%20%20%20%20%20articleNo%20%3B%20title%0A%20%20%20%20%201%20%3B%20first%20article....

There’s a bit more, much the same.

I get that Drafts uses one variant of markdown, but in theory, indenting the ‘{{{data’ block by 1 tab or 4 spaces should get it treated like a code block, and that’s clearly not happening.

Unfortunately, in spite of the positive comments and reviews I’ve read about Drafts, it’s looking to me, that’s it’s just not suitable for my purposes. Fundamentally I want an app that provides raw text exactly as entered. OK if markdown is an option, but there has to be a way of handling raw text with no markup needed or expected.

Perhaps Drafts doesn’t support this.

I can reproduce what you are seeing when I use an action based on using the standard Dropbox action step in combination with the triple curly braces your data has. Without those braces, it saved just fine. I suspect there’s a bug in how the action is handling that rather than it being Drafts doesn’t save plain text to Dropbox.

My best guess would be it is to do with how the [[draft]] tag is being evaluated as double curly braces are used in Drafts to convert a text string into a URL encoded string, which is what you are seeing - base64 encoding looks somewhat different to URL encoding. It looks to me like the outer set of double braces is causing an additional evaluation to be triggered.

This may be by design, or it may actually be a bug/functionality leak that is not intentional. Regardless, it is something that can be bypassed pretty easily by taking a route that specifically isn’t going to run through any template tag evaluation process.

Give this script based action I put together a try. It worked fine for me as a test case with your sample data. It does pretty much the same as the standard action for Dropbox saving (which I feel is more an example anyway personally) but grabs the drafts content directly without any template evaluation against that content.

JavaScript used by the action above
let dbx = Dropbox.create()
let strPath = draft.processTemplate("/[[date|%Y-%m-%d-%H.%M.%S]].txt")
let bWrite = dbx.write(strPath, draft.content, "add", true)
if (!bWrite)
{
	console.log(dbx.lastError);
	context.fail();
}

Note that nothing here is relating to any flavor of Markdown. Markdown is just plain text and so has no effect on raw data. Drafts does have some syntax highlighting that works with some Markdown formatting, but the text itself, including what is displayed remains intact. But if you do really want plain text you can set a draft to use plain text ‘syntax highlighting’.

Hope that helps.

You should also be able to escape the curly braces with a back-slash, like:

\{{{data
articleNo ; title
1 ; This is the first article
2 ; This is the second
}}}

But that is then, in effect, modifying the draft content to allow it to be processed by the Dropbox action step.

Is this behavior with the Dropbox action by design and just an unusual edge case, or is it a bug?

I tried the backslash - unfortunately, it doesn’t work. Makes no difference in fact

@sylumer: Thanks, but it won’t install on either the iPad or on the iMac. Would I need the Pro version?

I’ll have to experiment a bit, and learn more about how Drafts functions ‘under the skin’ I think. My original intention was to use it as a drop-in replacement for the standard-issue Notes, but it feels to be more capable, and hence more complex than that. Clearly the idea of just installing and using isn’t sufficient in the environment I currently work with.

To be honest, I’m wondering if it’s actually worth it for me. I greatly appreciate the help I’m getting here, but the fact that it’s not just a text editor may mean that it’s more sophisticated than I currently need.

You should be able to install without having a pro subscription in place. What do you see when you try to install it?

It is normally very straight forward, but just to ensure you have everything lined up, read the brief documentation on installing actions.

Setting the escape that Greg suggested didn’t work as was for me, but did change the output. I suspect if you look closely at the start, you’ll see how.

Thinking through about double curly braces, a subtle change breaks the encoding by ensuring two unescaped braces are not in sequence:

{\{{data
articleNo ; title
1 ; This is the first article
2 ; This is the second
}}}

This works for me with the Dropbox action utilising the Dropbox action step.

I would say give it a chance. You’re obviously having some very specific challenges getting going with a specific use case, but, whilst I am somewhat biased, I believe it is worth it. So many people rave about how great Drafts is … we can’t all be wrong can we?

Once upon a time computers vs typewriters were viewed the same way. But even if you don’t immediately use all of the power, or understand everything about it, having it there and building familiarity means that when a tool like Drafts can make the world of difference, you’re ready to dig a little deeper and tap into the power.

Now that’s interesting !

{\{{data
header data
}}}

works just as I’d want it to. And more to the point, the escape character (the backslash) disappears.

@agiletortoise, many thanks, you solution gives me what I want, and it’s both simple and harmless.

@sylumer: I agree that the positive reviews mean something, but even then there are times when specific use cases don’t work well with some products. I can live with the extra backslash, so for me, Drafts does what I need.

FYI, the triple curly braces are derived from the syntax of a Wiki I use for just about everything, but have been pushed into use to help with bulk metadata input, which is something else that I do a lot of. Now I have a second option which makes me happy.

Thanks very much for the assistance - I still feel the need to understand Drafts a little better, but now that I know it’s a working product (in my possibly peculiar environment), I’m happy to spend the time doing that.

Thanks again :smile:

I do consider this a flaw in the template engine. A more robust templating solution in on my (rather long) to-do list…but at least you’ve got a workaround for now.

1 Like