shurcooL-legacy / atom-markdown-format

Formats your Markdown text on save.

Home Page:https://atom.io/packages/markdown-format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linebreaks go away.

alex-kovac opened this issue · comments

Hi, Nice work with this package! Please forgive my insolence but this useful part of Markdown syntax is not preserved it seems: "When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return."

Do you have Atom configured to remove trailing white space?

I will look into this and see what can be done. Thanks for reporting.

Hi shurcooL, thanks for replying so fast.
Yes, "Whitespace" package was enabled. Disabling did not change the outcome. The line-break is still removed after saving. If it helps any, other than adding Markdown Format package, my Atom is out-of-the-box.

Yeah, the current code does not support this feature. I am considering adding support for it. Could you provide an example of a situation where it would be useful?

I usually rely on word-wrapping in the editor to wrap lines, and use separate paragraphs as breaks.

Ah yes, for example, in poetry, linebreaks such as these are useful for lines of a poem, while paragraph breaks are useful for denoting stanzas. Sorry for a slow reply on my side.

That makes sense, thanks.

I am working on this, but it may take some time. I'll report back with progress.

Great news! Thank you very much. I am aware that this is not an often used feature, but it is irreplaceable sometimes.... and perhaps it can make Markdown Format more complete... and therefore even cooler ;) Thanks!

I have a fix for this, pending russross/blackfriday#107 PR to the Markdown parser I'm using.

The next version of this package, when released, will have this fixed. :)

I've released 2.3.0 that has support for line breaks via two (or more) trailing spaces.

@alex-kovac, can you please test it out and confirm it works as expected?

Hi, @shurcooL, sorry for me replying late. Installed 2.3.1. here, but linebreaks are not preserved still. (Whitespace package is not activated.) If there is anything I can help you with, please let me know. Thnx!

It works for me using Atom 0.125.0 and markdown-format 2.3.1...

Title
=====

Linebreaks  
do  
work.

Are you putting two (or more) spaces after a line, immediately followed by another line? Have you restarted Atom since updating the package?

Works! Mea culpa. Atom 0.125.0 and markdown-format 2.3.1 after restarting... works! Thank you for amazing work and please excuse me for false reporting!

I did notice one small (non)issue. Try typing these two and then save:

List 1:
- one
- two
- three


List 2:

- one
- two
- three

Both lists will have the bullets recognized properly in a markdown file and the syntax highlighting will change the bullet color to blue as expected. When saving this file while using Markdown Format, the items in the list without an empty line before the list (List 1) get concatenated to one line.

List 2 formats as expected in Atom.

The (non)issue here is that the user might be misled by the GitHub flavored Markdown syntax highlighter and expect to have proper lists, but after saving the list might get concatenated.

Standard Markdown syntax indeed asks for a an empty line to divide paragraphs, while at GitHub:

The biggest difference with writing on GitHub is the way we handle linebreaks. With Markdown, you can hard wrap paragraphs of text to have them combine into a single paragraph. We find this causes a huge number of unintentional formatting errors. In comments, GitHub treats newlines in paragraph-like content as real line breaks, which is usually what you intended.

I cannot tell if it has been introduced by markdown-format 2.3. to justify leaving this issue in this thread.

Hi, I wanted to comment on this to ask a question before requesting a new feature.

I would like a setting to enable an alternate formatting mode where paragraphs with too-long lines and too-short lines will be normalized to fit into the current max columns setting in Atom in the same
way as the Ctrl-Alt-Q shortcut, but only for paragraphs and not tables, code listings, really long links, etc. The current behavior is that all lines in a paragraph are concatenated into a single line no matter what.

This feature would have no affect on the output but it would be very useful when editing pages that have deeply-nested code or very wide tables, because, with soft wrap turned off, you would be able to see paragraphs wrapped and wide listings not wrapped.

Why not just enable word wrap? Is it because your code and tables are too wide to fit and get wrapped also?

Yes, that's main main reason