Adding a Markdown tag automatically in a Drafts 4 action

I’m using [[line|1…]] in a Drafts 4 action to place each line in the body of my Drafts note as a new line in a specified Evernote note. It’s simple and works fine. I was wondering if there was a way to automatically add a Markdown tag (*) to the [[line|1…]] syntax to produce a bulleted list in Evernote.

Also…is there a way to omit any blank lines in the list in subsequently appended additions.

I see 30 people have looked at this. Any comments on whether this can be accomplished in Drafts 4? Or 5?

Missed this…a few comments:

If your Evernote action is configured for the template output of Markdown, it will get run through the Markdown parser and converted to HTML before being sent to Evernote (which uses it’s own nearly-HTML format ENML for notes). So, yes, if your template outputs a Markdown list, then it will get converted to an HTML list, and will be rendered.

If you want to have it rendered for each line, that requires scripting, because you would have to break up the text into lines and insert the "* " in each…something like:

// split draft body into an array of lines
let lines = draft.processTemplate("[[body]]").split("\n");
// process each line prepending "* "
lines = lines.map(ln => "* " + ln);
// store the result as a new tag to use in the Evernote step
draft.setTemplateTag("content", lines.join("\n")); // Drafts 5 version
// draft.defineTag("content", lines.join("\n")); // Drafts 4 version

(Note the tag definition method changed in Drafts 5, included both versions)

Then, the note template in the Evernote step after this script can use [[content]] to include the modified content with the list markings.

It is not possible to avoid the blank line appending to Evernote via Markdown. The Markdown processor will create a new full list tag to wrap the lines so you are creating a new list each time, not adding to the existing one.

1 Like

Thank you…this was very helpful