New lines inside paragraph in README.md
Solution 1
Interpreting newlines as <br />
used to be a feature of Github-flavored markdown, but the most recent help document no longer lists this feature.
Fortunately, you can do it manually. The easiest way is to ensure that each line ends with two spaces. So, change
a
b
c
into
a__
b__
c
(where _
is a blank space).
Or, you can add explicit <br />
tags.
a <br />
b <br />
c
Solution 2
You can use a backslash at the end of a line.
So this:
a\
b\
c
will then look like:
a
b
c
Notice that there is no backslash at the end of the last line (after the 'c' character).
Solution 3
If you want to be a little bit fancier you can also create it as an html list to create something like bullets or numbers using ul or ol.
<ul>
<li>Line 1</li>
<li>Line 2</li>
</ul>
zoran119
Updated on August 18, 2021Comments
-
zoran119 almost 3 years
When editing an issue and clicking Preview the following markdown source:
a b c
shows every letter on a new line.
However, it seems to me that pushing similar markdown source structure in README.md joins all the letters on one line.
I'd like the new lines preserved in the README.md in this project: https://github.com/zoran119/simple-read-only-test
Any idea how?
-
Guilherme Ferreira over 7 yearsThank you so much. My documents will be much better now!
-
Ben Creasy about 7 yearsaccording to stackoverflow.com/questions/18019957/… Github-favored markdown is not used everywhere on Github. Might be outdated though.
-
Ev. over 6 yearsGracias mi amigo!
-
Christian Seiler about 6 yearsThe question is about new line within a paragraph
-
Pierre over 5 yearsAccording to the link you give, it's now possible to create line breaks "by leaving a blank line between lines of text." There is still a problem: with this method, you create a new paragraph, not just a line break.
-
Dato over 5 yearsAs @BenCreasy said, Github-flavored markdown is not used in README.md files. Or, to be fair, not the full set of features is used: syntax highlighting and auto-linking URLs are available; hard line breaks, formatted task lists and references to issues—aren’t.
-
user3015682 over 4 yearsForward slash doesn't seem to be necessary, worked fine with just <br>
-
Thiago Valentim over 4 yearsThe forward slash sounds like a workaround but works well instead the html tag already is a formal way to do the task. Thanks so much @tbekolay! your answer helps me a lot.
-
Manuel over 3 yearsI tried it for Bitbucket and the only format that worked were the 2 blank spaces. Anything else (<br>, <br />, Backslash) didn't work.
-
Celdor over 3 yearsThanks. This works for me outside GitHub where the other solutions did not.
-
Admin over 2 years<br> works well for me, but 2 spaces are not working for me (GitHub README.md file).