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

raytry commented Nov 29, 2017

I noticed that the

hello\
world

also causes line break.

@rgolangh

This comment has been minimized.

Copy link

rgolangh commented Feb 13, 2018

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

@calebboyd

This comment has been minimized.

Copy link

calebboyd commented Mar 7, 2018

Also:

Hello&nbsp;
World

Hello 
World

@nltesown

This comment has been minimized.

Copy link

nltesown 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

SolidSoils 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

michael-freidgeim-webjet 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

olos00 commented May 1, 2018

Thanks! :)

@GrandAlf

This comment has been minimized.

Copy link

GrandAlf 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

darkain 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

Swoorup commented May 24, 2018

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

@kritoth

This comment has been minimized.

Copy link

kritoth commented Jun 19, 2018

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

@matchavez

This comment has been minimized.

Copy link

matchavez 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

Anwar-Faiz 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

bell-jamesl commented Jul 14, 2018

Thanks! :)

@Sungmiii

This comment has been minimized.

Copy link

Sungmiii commented Jul 24, 2018

Thank you !

@bexoss

This comment has been minimized.

Copy link

bexoss commented Oct 14, 2018

Hello world

@MoatazAbdAlmageed

This comment has been minimized.

Copy link

MoatazAbdAlmageed 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

peeyush81 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

androidfanatic commented Dec 13, 2018

This




is just a test.

@liuchong

This comment has been minimized.

Copy link

liuchong commented Dec 14, 2018

nice gist!

@isratmir

This comment has been minimized.

Copy link

isratmir commented Dec 25, 2018

Thanks man

@BakrFrag

This comment has been minimized.

Copy link

BakrFrag 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

BakrFrag 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

mahiki 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

sosospicy commented Jan 30, 2019

hello
world

"```" works.

@Chenghan-Sun

This comment has been minimized.

Copy link

Chenghan-Sun commented Feb 7, 2019

hello
world

@jolson787

This comment has been minimized.

Copy link

jolson787 commented Mar 4, 2019

hello\ world

@YingtongDou

This comment has been minimized.

Copy link

YingtongDou commented Mar 4, 2019

this  
a test

@RobertShaw1

This comment has been minimized.

Copy link

RobertShaw1 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

eyecatchup commented Mar 17, 2019

@RobertShaw1 CommonMark is not Markdown. ;)

@Joon-S

This comment has been minimized.

Copy link

Joon-S commented Mar 20, 2019

hello/ world

@ho0kim

This comment has been minimized.

Copy link

ho0kim commented Apr 14, 2019

hello

world

@resarahman

This comment has been minimized.

Copy link

resarahman commented Apr 24, 2019

Hello  Word

@cnukaus

This comment has been minimized.

Copy link

cnukaus 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

Risyandi commented Jun 2, 2019

Thank you.

@kartikynwa

This comment has been minimized.

Copy link

kartikynwa commented Jun 13, 2019

Thanks
a
lot.

@NabiKAZ

This comment has been minimized.

Copy link

NabiKAZ 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>.

@V0idk

This comment has been minimized.

Copy link

V0idk commented Jul 25, 2019

thank
you

@dwy6626

This comment has been minimized.

Copy link

dwy6626 commented Jul 31, 2019

This awesome note got more stars than its word counts
lol

@XiaojiaoChen

This comment has been minimized.

Copy link

XiaojiaoChen commented Aug 11, 2019

hello\ world

@XiaojiaoChen

This comment has been minimized.

Copy link

XiaojiaoChen commented Aug 11, 2019

hello
world

@superarts

This comment has been minimized.

Copy link

superarts commented Aug 19, 2019

How to break a long line without space? Something like:

但是可以运行慢得要死的Java虚拟机的现代手机等硬件来说(Java爱好者肯定能拿出一百个例子来说明Java并不慢,我一直不明白,byte code和垃圾回收这种机制不可能在所有场合下都能取得比机器代码加引用计数同样的效率这点,怎么会有人不明白,而且下文会说,并不是机器效率越高,一个语言就越成功),值类型在大多数应用场景不再是一个问题。对大型工程来说,人们更看重的是架构层面的问题。把同一段内存,也就是一个object,用不同的reference来表达,这种方式本质上是会造成架构问题的。要求一个程序员在修改一个内存变量的时候,心中时刻记得所有指向同一内存地址的变量,需要时刻记得相关的所有变量,这样的要求会引发更多犯错误的可能。Swift之所以把可变性作为一个重点问题来抓,原因就是在现实中,可变性引发的bug实在太多太多了。因此Swift会强制你在传递或者复制一个对象的时候,除非特别制定,否则默认会真的复制一段内存内容出来,这样可以保证不变的对象是真的不变。

@AweiLoveAndroid

This comment has been minimized.

Copy link

AweiLoveAndroid commented Oct 12, 2019

Title1 Title12
Inreoduces.:
xxxxxxxxxxxxxxxxxxxxxxxx
Inreoduces:
xxxxxxxxxxxxxxxxxxxxxxxx
Inreoduces:
xxxxxxxxxxxxxxxxxxxxxxxx
@mirhmousavi

This comment has been minimized.

Copy link

mirhmousavi commented Nov 12, 2019

Thanks

@luengark

This comment has been minimized.

Copy link

luengark commented Dec 6, 2019

This
is
a
test\

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.