MD - Copy as rich text

I installed the action to copy Markdown text as rich text. This is working fine. But I was wondering if there is a way to preserve the line breaks? After pasting I have to define my ‘next lines’ again.

For example:
Sentence one.
Sentence Two.

Becomes (after pasting):
Sentence one. Sentence Two.

Markdown ignores line breaks. If you want to force a line break, put two spaces at the end of the line. Related spec docs.

Hope this helps!

1 Like

Is there an action to append each line with two spaces? Did not find any in the directory.

I’m not sure which of the copy actions you were using, so I just went with a version of the simplest one for you. I’ve incorporated adding the standard Markdown double spaces to the text the action processes. It will leave the original draft untouched.

Generally though, getting into the habit of using double spaces and blank lines when working with Markdown will make your Markdown syntactically correct for your needs and more transportable. Not every system that uses Markdown will offer the same affordances as Drafts and Markdown continues to surface in more and more places as a text entry option.

1 Like

Great, thanks a lot for this. Works perfect … Tried to make a combination of your action with an earlier one of agiletortoise where you can define the output typeface (I prefer to paste a sans serif typeface instead of the serif one), but I did not manage.

That’s why it always pays dividends to link to an action as there are often several similar ones and ones an individual has modified (or created with the same name).

I have a pretty good idea which one it is, but please do always try to include a link to the specific original action. It does save time :nerd_face:

How about something like this?

1 Like

Thanks a lot! Exactly the action I was looking for. Thanks for mentioning the link to the specific action. I will keep this in mind for next time! (I am quite new here on the forum)

I highly recommend that you switch to Github Markdown when using Drafts. This will allow you to use linebreaks by inserting a \ at the end of the line, so the following syntax would work:

This is the first paragraph.\
This is the second line in first paragraph.

This is second paragraph.

Please note that the default actions shipped with Drafts tend to rely more on Multi Markdown rather than respecting the defaults the user selects under Markdown to HTML. I have asked if this could be changed, but I was told that people like it, so not at the moment. But my hope still is alive.

Therefor you will need to find an alternative action that will respect the Markdown parser you have set in Drafts preferences.

Note: For some very strange reason the output of rich text is very different than the preview you get from using the preview functionality in Drafts on Mac OS. I have for months tried to figure out why headings are stripped when copying as rich text, but shown in the preview. It could be a bug, but also a feature I am not aware of. Therefor I mostly preview my Draft, copy it and then paste it if I need it to go anywhere else. Hopefully this will be corrected at some time, but I don’t know how to provide good details about this.

MultiMarkdown also supports using \ to force a line if you enable “Escaped line breaks” in MultiMarkdown options. Personally, I prefer spaces because they are part of the original Markdown spec, and don’t create additional characters you might want removed if using the content as plain text.

I’m not sure what you are saying about headings being removed. “Rich Text” does not have headings in any semantic ways, but # Heading style Markdown headings are treated as bold/larger text by the Rich Text conversion actions. These rely on Apple’s routines to convert HTML to Rich Text.

1 Like