Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Line breaks in markdown
Hello  (<-- two spaces)
World

Hello
World


Hello
World

Hello World


Hello<br/>
World

Hello
World


Hello

World

Hello

World

@raytry

This comment has been minimized.

Copy link

commented Nov 29, 2017

I noticed that the

hello\
world

also causes line break.

@rgolangh

This comment has been minimized.

Copy link

commented Feb 13, 2018

@raytry That's even better, cause it is visible. Thank you.

@calebboyd

This comment has been minimized.

Copy link

commented Mar 7, 2018

Also:

Hello&nbsp;
World

Hello 
World

@nltesown

This comment has been minimized.

Copy link

commented Mar 26, 2018

Thanks a lot for the backslash tip. The double space never was a very good idea.

@SolidSoils

This comment has been minimized.

Copy link

commented Apr 13, 2018

@Raytray: While hello\ works with a few Markdown parsers, it is not part of the specification and therefore some parsers ignore it. However, it sure looks elegant and i.m.o. it would be nice if it would be added to the Markdown specification.

For now the only solid solution seems to be the good old <br/> tag, which looks a bit clumsy for such a basic layout feature.

@michael-freidgeim-webjet

This comment has been minimized.

Copy link

commented Apr 15, 2018

I've noticed that backslash is working as new line only if it is a last character. If it has trailing spaces(e.g. "hello\ "), backslash will be shown literally in the output

@olos00

This comment has been minimized.

Copy link

commented May 1, 2018

Thanks! :)

@GrandAlf

This comment has been minimized.

Copy link

commented May 7, 2018

interestingly, if we put \ at the end of a line without test on the next line, it shows up in the text
Previous line has an invisible \, this line has it visible\

the last one is visible because an empty line follows it

@darkain

This comment has been minimized.

Copy link

commented May 10, 2018

Yeah, the double-space thing is a bad idea in general because many text editors automatically trim white-space at the end of each line upon saving. Its best to use a form that'll work for the most amount of people.

@Swoorup

This comment has been minimized.

Copy link

commented May 24, 2018

I am appalled how I would have to google for this, lol !!!

@kritoth

This comment has been minimized.

Copy link

commented Jun 19, 2018

for me only Shift + Enter worked. No
and no </kbd>

@matchavez

This comment has been minimized.

Copy link

commented Jul 3, 2018

The backslash is the only way it works within a block quote, as well. shift+enter doesn't.

@Anwar-Faiz

This comment has been minimized.

Copy link

commented Jul 11, 2018

A good explanation along with a github commit is posted at:

http://www.w3lc.com/2017/05/new-line-in-readme-file-github-fixing.html

I think this will help the readers and people searching answer to fix this issue!

@bell-jamesl

This comment has been minimized.

Copy link

commented Jul 14, 2018

Thanks! :)

@Sungmiii

This comment has been minimized.

Copy link

commented Jul 24, 2018

Thank you !

@bexoss

This comment has been minimized.

Copy link

commented Oct 14, 2018

Hello world

@MoatazAbdAlmageed

This comment has been minimized.

Copy link

commented Oct 15, 2018

Testing
npm install #may you need sudo
npm start
navigate to http://localhost:3000\

@peeyush81

This comment has been minimized.

Copy link

commented Dec 7, 2018

This project is built on symfony 4 and php 7.2.
To get development environment working -
composer install
brew install yarn
yarn install
yarn encore dev
php bin/console server:run
add this to ~/.gitignore_global
https://github.com/symfony/demo/blob/master/.gitignore

@androidfanatic

This comment has been minimized.

Copy link

commented Dec 13, 2018

This




is just a test.

@liuchong

This comment has been minimized.

Copy link

commented Dec 14, 2018

nice gist!

@isratmir

This comment has been minimized.

Copy link

commented Dec 25, 2018

Thanks man

@BakrFrag

This comment has been minimized.

Copy link

commented Jan 3, 2019

markdown transferred to html in browser so you can use html tags inside markdown file
so you can use all html tags for newline you can use <br>

@BakrFrag

This comment has been minimized.

Copy link

commented Jan 3, 2019

this examples of using both html and markdown to get same results
bold from markdown



also bold from html

itaclic from markdown

also italic from html

so if you want to make newline in markdown you can use <br>

@mahiki

This comment has been minimized.

Copy link

commented Jan 10, 2019

Why does markdown do this? If I want two lines to run consecutively I won’t introduce a newline.

Every editor can wrap text, I’m truly at a loss. Now we have to have <br> everywhere, or double spaced lines, or that silly two-spaces thing.

@sosospicy

This comment has been minimized.

Copy link

commented Jan 30, 2019

hello
world

"```" works.

@Chenghan-Sun

This comment has been minimized.

Copy link

commented Feb 7, 2019

hello
world

@jolson787

This comment has been minimized.

Copy link

commented Mar 4, 2019

hello\ world

@YingtongDou

This comment has been minimized.

Copy link

commented Mar 4, 2019

this  
a test

@RobertShaw1

This comment has been minimized.

Copy link

commented Mar 16, 2019

@Raytray: While hello\ works with a few Markdown parsers, it is not part of the specification and therefore some parsers ignore it. However, it sure looks elegant and i.m.o. it would be nice if it would be added to the Markdown specification.

For now the only solid solution seems to be the good old
tag, which looks a bit clumsy for such a basic layout feature.

@SolidSoils: https://spec.commonmark.org/0.28/#hard-line-breaks

@eyecatchup

This comment has been minimized.

Copy link

commented Mar 17, 2019

@RobertShaw1 CommonMark is not Markdown. ;)

@Joon-S

This comment has been minimized.

Copy link

commented Mar 20, 2019

hello/ world

@ho0kim

This comment has been minimized.

Copy link

commented Apr 14, 2019

hello

world

@resarahman

This comment has been minimized.

Copy link

commented Apr 24, 2019

Hello  Word

@cnukaus

This comment has been minimized.

Copy link

commented May 18, 2019

two spaces doesn't work for my GIthub MD? will use
back slash

@Risyandi

This comment has been minimized.

Copy link

commented Jun 2, 2019

Thank you.

@kartikynwa

This comment has been minimized.

Copy link

commented Jun 13, 2019

Thanks
a
lot.

@NabiKAZ

This comment has been minimized.

Copy link

commented Jun 24, 2019

for me only Shift + Enter worked. No
and no

You are right for issue comments, but don't work for README.md in the github, and needed <br>.

@serdarsen

This comment has been minimized.

Copy link

commented Jul 21, 2019

Thank you

@V0idk

This comment has been minimized.

Copy link

commented Jul 25, 2019

thank
you

@dwy6626

This comment has been minimized.

Copy link

commented Jul 31, 2019

This awesome note got more stars than its word counts
lol

@XiaojiaoChen

This comment has been minimized.

Copy link

commented Aug 11, 2019

hello\ world

@XiaojiaoChen

This comment has been minimized.

Copy link

commented Aug 11, 2019

hello
world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.