Forcing a newline / hard line break / carriage return - canonical

Looking for advice on the most future-proof / canonical way to add line breaks in my writing. I have the Strict Line Breaks option turned ON because I want to stick as close as possible to standard markdown rendering so when I open notes in other programs, they render the same.

I am aware of these 3 methods:

this way uses standard HTML <br> tag:

this way works<br />
but is ugly &  ^^ tedious!

This way uses a \ at the line ending (nb: does not render correctly in some viewers e.g. QLMarkdown):

this example\
.....uses a ^backslash

and lastly this one, which looks pretty & seems to render in most apps, but I don’t love it because you can’t tell from looking at it which lines have the spaces:

this example...  
puts 2 spaces  ^^ here

Which way are you guys using? Or is there any better method I am not aware of?
I think ideally I would like method #3 if I could somehow make the 2 spaces visible somehow (maybe with CSS?)

3 Likes

Another discussion on line breaks: How to add multi line breaks in preview mode

Right, this line break issue creates a dilemma. I have switched scrict line breaks off, but as you say, this is a deviation from the Markdown standard.

I also really dislike the MarkDown syntax with the two whitespaces at the end. Actually I think it’s a design failure in Markdown. First, as you say, they are not visible unless you use the “show whitespace” plugin, but more importantly, many text editors silently remove white space at the end of lines when saving (which makes sense for many reasons, e.g. version control and diffing). Also, why does Markdown want two whitespaces?

“truth” gave an elegant answer:
Use:
\
\
\
\
\
<tab> (actual tab key)

Which is a nice way of dealing with it and appears to be quite compatible.

Hi luckman212, I’ll give you my 2 cents.

I try to avoid line breaks as much as I can. Usually they are required for code,
so I use a block code when I need them, but I cannot format content inside it.

AFAIC the 3 options you mentioned are the only ones that exist.

Invisible spaces

Making the 2 spaces visible with CSS or a plugin as Cito says could be an option, but as he also adds:

many text editors silently remove white space at the end of lines when saving

HTML invasion

I think the HTML alternatives - using the <br /> tag or the &emsp; entity - break the simplicity and clarity of markdown. You can solve almost any need you have with HTML inside an MD file and it’s the most compatible solution. Why don’t we use <table> too?

Backlash to the rescue

The backslash \ seems to be the best way to achieve this (to me at least). As you state, some pure md editors won’t render them correctly, even though it is considered as an option in the CommonMark Spec for the Hard line breaks:

For a more visible alternative, a backslash before the line ending may be used instead of two spaces:
Example 631

1 Like

Thank you @andrezgz for your thoughtful reply. I agree & try to avoid linebreaks when possible. When I have to use them, somehow I find myself adapting to the xxx__ 2 spaces at the line ending. It just looks the cleanest.

Hey guys, since Quiver understood this way back then I am using this little html snippet for line breaks. Seems to work fine here as well!

 <div style="page-break-after: always;"></div>
1 Like

The backslash “” does not work for me in a table cell. Is this normal?
So I used < br >. Is this is my best option?

4 Likes

@Cedric, that’s what I use. If there’s an easier way, I’m all eyes.

1 Like

I am really REALLY curious.
Is this a way to tell HTML to respect a “line brake”? :eyes:
If so. Can you explain the “how to”, for people like me who aren’t that used to HTML.

1 Like

Just as you say: this is how you tell the output in HTML that you want a page break to occur, not line break. Since Markdown is based on HTML, it’s not that far-fetched to see this working in a Markdown parser.
The how-to is rather simple: everywhere that you want a page break to occur in your printed document (alas, you need pages for it to work, right?), you insert this line of code. The nice thing is that this line is conveniently hidden in preview mode, so that you can format for print while your normal preview is unaffected.
Does that clarify? Please write if something is still unclear.

1 Like

I am afraid, I think this is the best solution at the moment. Also check out the neat “advanced tables” 3rd party plugin, this might help a lot with convenience!

1 Like

Linking to this post that describes a hacky workaround for inserting an invisible em space: How to add multi line breaks in preview mode - #13 by chrsle