Jump to content

preserving line breaks from Markdown text?


Recommended Posts

Hi all,

I often need to copy markdown text (typically from Obsidian) from my desktop and paste it on my phone using the Universal Clipboard, but the pasted text loses all line breaks. 

 

If I show the clipboard in Terminal with pbpaste, the line breaks are shown correctly, but if I paste on my iPhone they are gone. I tried to replace \n with \r and \r\n in the clipboard, to no avail. I also tried to covert to RTF using @vitor's MarkdownTransform, but I still lose the line breaks. 

 

A suboptimal workaround is to first paste the text in a rich-text format app, then copy it from there, but that introduces an extra line break. 

Does anybody else have the same issue? I was hoping to create a Universal Action to copy text for the purpose of pasting it via Universal Clipboard while preserving the line breaks. 

Link to comment
4 hours ago, giovanni said:

I tried to replace \n with \r and \r\n in the clipboard, to no avail.

 

Have you tried replacing it with \n\n? Or try three or four. I had to do that with Markdown Transform for pasting as BBCode. Also try adding two spaces at the end of each line to force a line break.

 

It would be useful to know where the collapsing is happening. I suspect it might the app you’re pasting to on iOS.

Link to comment

thanks, good suggestions! Extra spaces or \n don't help. 

1 hour ago, vitor said:

I suspect it might the app you’re pasting to on iOS.

Yes, it is Gmail for iPhone. Pasting works fine in Apple Notes... therefore a slightly better workaround is to paste in Notes first, then copy and paste in Gmail. Thanks!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...