Wondering if I’m missing something obvious. I love writing in Drafts. In iOS exclusively, have been working on a good workflow between Drafts, Things 3, DTTG and Obsidion.
A stumbling block that I can’t seem to sort out: in my day to day I have a need to move text onto company letterhead using Word before generating a PDF for distribution. When I copy rich text into Word, fonts come in large and it takes a lot of doing to format headers, font, bullets, etc. I’ve tried quite a few things, the clipboard action, copy / pasting out of the preview, Siri Shortcuts for copy to Rich text, tried and failed making new actions.
I feel like I might be misunderstanding a core tenet of software, that it’s not intended for this type of output, but it’s such a Swiss-army knife for so many things I think I’m missing something obvious.
Help, thoughts, a point in the right direction appreciated.
I’ve found the Action that saves to Google Drive to be more effective. I get everything set correctly in Google Docs and then download it as a Word doc. The process requires a couple of “hoops” but it does work. I’d love a more native conversion, Bear (sorry) has an excellent save as word doc as does IAwriter, both of which I’ve abandoned for Drafts.
Markdown is designed to convert plain text markup to HTML.
The HTML generated by Markdown is semantic, but not styled. Meaning it marks blocks of text, heading, bold, italics, etc., but does not have specific fonts/font size/color associated with that content.
HTML get styles, like fonts, from CSS applied to the HTML.
When you open a preview in Drafts, it is in an HTML template with styles assigned that apply fonts, etc. If you select text in a preview, just like in Safari, and copy, the system brings those applied styles with the rich-text in the clipboard, and will paste those along with the text when pasting into apps like Word that support rich-text.
The “Copy as Rich Text” example action does essentially the same thing without the need to open a preview. It still converts your Markdown to HTML, puts it in a template with CSS styles, and copies that result to the clipboard as rich-text.
If you look at the script in the “Copy as Rich Text” action, you can see the HTML template applied, and it’s styles.
Those could be modified to apply other font-family, font-size attributes…or styles removed entirely. This version of the action omits the “style” attribute in the <body> tag, which might allow the output to be more flexible to picking up the styles in the host document when pasted. That is somewhat dependent on how the app you are pasting into implements rich-text pasting.
Thinking more widely you could parse the HTML and do all sorts of things with the DOM tree. (I’m not quite sure how you’d parse the HTML in this incarnation of javascript, mind.)