Bold [[time]] and send to Bear

I want to create an action that appends to a Bear note. I re-worked the Append to Bear Journal and have it working to send the note from Drafts to Bear with the date and time using [[time]] a colon and then the text of the draft. What I would like to do is first do a hard return so there is a space between the last note and the new one and then make the date and time created using the [[time]] code show as bold text in Bear. If I use an asterisk or two asterisks like this [[time] it shows up the same [[time]] instead of in bold. I do NOT know how to write scripts AT ALL. So if this is a stupid question, I apologize.

If you don’t have Markdown compatibility mode enabled, try this URL in your script.

bear://x-callback-url/add-text?title=Journal-[[date|%Y-%m]]&text=%0A%2A[[time]]%2A%3A%20[[draft]]&mode=append

If you do have it enabled, try this one instead.

bear://x-callback-url/add-text?title=Journal-[[date|%Y-%m]]&text=%0A%2A%2A[[time]]%2A%2A%3A%20[[draft]]&mode=append

Hope that helps.

1 Like

That worked to bold the text! Thank you very much! Is there any way to add a blank line before appending the text to the note in Bear? Also, if anyone has any good books, articles, etc. that they can recommend so that I can learn how to write these scripts myself I would appreciate it. Thank you again for your help.

Previously you asked for a “hard return”. The %0A did that. To make a blank line just put two of those in consecutively for two newlines characters in a row.

Note that this isn’t scripting, but just a bit of URL knowledge.

This article is a good place to start to understand how the tags and templates work to configure actions:

I would note that this gets a lot easier with URLs if you use the “Define Template Tag” action step, because you can setup the text you want to send without having to worry about the URL encoding.

For the example above, you could add a Define Template Tag step, with the tag name set to “mytext” above the “Open URL” step, and enter the information like this:

*[[time]]*: [[draft]]

Then, use the URL:

bear://x-callback-url/add-text?title=Journal-[[date|%Y-%m]]&text=[[mytext]]&mode=append

Drafts will take care of doing the encoding for the URL and replace the [[mytest]] in the URL with the results of the template step above.

1 Like

I got it working perfectly! Thank you so very much! And thanks for the info that this is not scripting but URL knowledge. I was not joking that I did not know how to write these things at all. Thank you again for the courtesy of taking the time to help me. It is much appreciated.