You know that thing where you’re writing markdown and you hit “Enter” twice to make a new paragraph? Thanks, Google Docs and Microsoft Word, for training us that double-enter is the only way to live.
Such as this...
...then you get this.
Which gives you:
<p>Such as this...</p>
<p>...then you get this.</p>
But sometimes you don’t want a whole paragraph break. You just want a single line break, like when you’d use
in HTML (because apparently we can’t escape HTML even when we’re trying to escape HTML). It’s like that friend who keeps showing up uninvited to your minimalist lifestyle.
<p>
Such as this... <br />
...then you get this.
</p>
I run into this all the time when I’m writing documentation or blog posts. You’re trying to format a list of steps, or maybe you want to break up a long sentence for readability, but every time you hit enter you get this massive paragraph gap that makes everything look like a ransom note. It’s one of those small things that can really slow down your writing flow when you’re constantly fighting with the formatting instead of just getting your thoughts down. They say Markdown is simple, but apparently “simple” means “works great until you want to do anything slightly different.”
Sure, you could just throw a <br />
tag right into your markdown. It works fine! But if you want to keep things clean and HTML-free (like some kind of purist who thinks they’re better than the rest of us), here’s a neat trick: add a backslash \
at the end of your line.
Such as this...\
...then you get this.
Pretty simple, right? It’s like finding out you can use a paperclip to reset your router - obvious in hindsight, but nobody tells you about it upfront.
One heads up though - not every markdown processor supports this. I’d definitely test it out with whatever you’re using before you ship anything. Some processors also let you add two spaces at the end of a line (literally just hit spacebar twice), but since most code editors auto-trim whitespace faster than you can say “trailing spaces,” I stick with the backslash method. It’s like choosing between a driver and a 9-iron - both might get you there, but one’s way more reliable.
That’s it! Nothing revolutionary, just a handy little thing that makes markdown a bit more flexible when you need it. Now you can format your text without looking like you’re afraid of the enter key.