"Copy as markdown" adds empty lines

bug
textediting

#1

When copy as markdown and paste to another markdown applications(I tried Ulysses and Bear), new empty lines were added between paragraphs. I think it’s weird. When I write articles with Ulysses or Bear, new empty lines are not needed to mark out a new paragraph or section. I suppose it’s a bug.

Using Agenda v2.0 beta1 and the latest versions of Ulysses and Bear.


#2

Paragraphs are separated by an empty line in Markdown. See https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet under Line Breaks.

I don’t know how Bear and Ulysses handle them. I tried in Bear, and without an extra empty line, there is no paragraph delineation (eg extra space), so I assume it also requires an empty line for a paragraph. It is a markdown editor, so I assume it must.

If I have misunderstood, please post a screenshot to demonstrate.

Kind regards,
Drew


#3

The attachment is a demo. After pasting, there is empty lines between the three lines.


#5

Yes, that is correct behavior, according to the markdown standard. Without that, if you paste into a web site with markdown, the three lines will not be separate paragraphs, which is what they are in Agenda.

If you don’t want the 3 lines to be separate paragraphs, you could use a list, or use CTRL-return to create a line break without a paragraph break.

Here is the relevant section from the Markdown spec:

Line Breaks
My basic recommendation for learning how line breaks work is to experiment and discover – hit once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You’ll soon learn to get what you want. “Markdown Toggle” is your friend.

Here are some things to try out:

Here’s a line for us to start with.

This line is separated from the one above by two newlines, so it will be a separate paragraph.

This line is also a separate paragraph, but…
This line is only separated by a single newline, so it’s a separate line in the same paragraph.

If you don’t need markdown syntax, you could copy normally, and then use Edit > Paste and Match Style to get a plain text paste, which would not include the extra paragraph space.


#6

Thank you for your explanation.