Exporting Drafts with Markdown formatting

drafts

#1

I am looking for a way to export Markdown text in a draft (Drafts App) into some other application (using Siri Shortcuts). If I just export [[draft]], then all I get is the Markdown formatting. I am wanting to export the rich text after it has been converted from Markdown but I am stuck on how to do that.


#2

You could use the %% notation when exporting from Drafts if you wanted to work with HTML, but it isn’t essential.

In Shortcuts the “Make Rich Text from Markdown” is the more direct path if you are using Shortcuts. Use a Drafts action to share the Markdown text to the shortcut (you may need to URL encode it, so take a look at the curly bracket notation in the screenshot above). Feed that directly into your Markdown conversion action, then push that out to the clipboard, share sheet, file, or wherever else you need it to go. It’s a one or two action shortcut.

Hope that helps.


#3

I did see that in the Drafts support document and also have tried the Shortucts action “Rich Text from Markdown” and have even tried the “Rich Text from HTML”. I am trying to put that text into an email body with Shortcuts, but the text never comes out formatted into Rich Text.

I may be doing something wrong, but I feel like I’ve tried every possible way and nothing has worked.

Thanks


#4

Okay, so it isn’t an arbitrary destination, but specifically for an e-mail.

The screenshots below are an example using the standard Email action in Drafts 5. Is there something that this action alone doesn’t do for you that you need? If you have specifics, that can really help home in on a suitable solution/answer.


#5

Here’s a shortcut I use regularly to send an email with rich text from Markdown. My original includes URLs and automates location, host, leader. This sample is stripped down but will show the steps.
https://www.icloud.com/shortcuts/7b312a94fcc847e1b8db2d129366fb19


#6

It isn’t arbitrary, but because of some of the other processes that are included when sending mail, I need to export it into Shortcuts before sending the mail. I did figure out what I was doing wrong, however.

I was immediately converting the input in the Shortcut using the “Make Rich Text from HTML” just like you had suggested, but later I was including that converted text into a text box along with other things before placing it in the email.

What I was doing wrong was converting it first. Once I moved the “Make Rich Text from HTML” to right before putting it in the email via the email shortcut action, then everything works perfectly. I was unknowingly taking that converted Rich Text and putting it back into plain text, therefore nothing was showing as converted.

It was as simple a matter as waiting to convert html to rich text until the very end of my Siri Shortcut.

Thanks for the help!


#7

Glad you got it working. :sunglasses:

When you have an issue, it is always worth including some screenshots/examples and wherever possible, a copy of the script/shortcut/etc. of what was being used. This can significantly reduce the amount of time it takes to home in on the solution.