Markdown to Day One

I’ve just subscribed to Drafts 5 and I’m very pleased to see this Discourse forum.

I’ve used Drafts 4 for some time but never had much success sharing markdown text. In particular I’m keen to export to Day One for journaling.

How would I create (or find) an action to create a new journal entry in a selected journal in Day One and then paste markdown text correctly?

Thanks

First, know what Day One is looking for. See their URL scheme docs. Since you want to specify a specific journal, you will need to include journal=whatever in your URL.

Second, you need to ensure that your text is escaped as part of the URL. There’s a standard JavaScript function for doing this.

Here’s the final part of an action I use to post to Day One:

body = encodeURIComponent(body);

let tagString = encodeURIComponent( tags.join(',') );

let url = `dayone://post?entry=${body}&tags=${tagString}`;

app.openURL(url);

In your case, be sure that the value of the journal option is encoded.

The same could be done without scripting using an “Open URL” action step as follows:

dayone://post?entry=[[draft]]&tags=[[tags]]&journal={{My Journal Name}}

Obviously edit the “My Journal Name” as appropriate. The URL step will handle the necessary URL encoding for you (the {{ }} wrapped around the journal name will as well).

2 Likes

Thanks for the responses.

I tried the URL @agiletortoise and it worked exactly as I hoped. Thanks very much!

1 Like

Thanks for this. I’ve got the URL working but grateful for your help!