How to add empty spaces into MD markdown readme on GitHub?
Solution 1:
You can use <pre>
to display all spaces & blanks you have typed. E.g.:
<pre>
hello, this is
just an example
....
</pre>
Solution 2:
Markdown really changes everything to html and html collapses spaces so you really can't do anything about it. You have to use the
for it. A funny example here that I'm writing in markdown and I'll use couple of here.
Above there are some
without backticks
Solution 3:
Instead of using HTML entities like
and  
(as others have suggested), you can use the Unicode em space (8195 in UTF-8) directly. Try copy-pasting the following into your README.md
. The spaces at the start of the lines are em spaces.
The action of every agent <br />
into the world <br />
starts <br />
from their physical selves. <br />
Solution 4:
Markdown gets converted into HTML/XHMTL.
John Gruber created the Markdown language in 2004 in collaboration with Aaron Swartz on the syntax, with the goal of enabling people to write using an easy-to-read, easy-to-write plain text format, and optionally convert it to structurally valid HTML (or XHTML).
HTML is completely based on using
for adding extra spaces if it doesn't externally define/use JavaScript or CSS for elements.
Markdown is a lightweight markup language with plain text formatting syntax. It is designed so that it can be converted to HTML and many other formats using a tool by the same name.
If you want to use »
only one space » either use
or just hitSpacebar
(2nd one is good choice in this case)more than one space » use
+space (for 2 consecutive spaces)
eg. If you want to add 10 spaces contiguously then you should use
space
space
space
space
space
instead of using 10
one after one as the below one
For more details check
- Adding multiple spaces between text in Markdown,
- How to create extra space in HTML or web page.
Solution 5:
I'm surprised no one mentioned the HTML entities  
and  
which produce horizontal white space equivalent to the characters n and m, respectively. If you want to accumulate horizontal white space quickly, those are more efficient than
.
- no space
-
-
 
-
 
Along with <space>
and  
, these are the five entities HTML provides for horizontal white space.
Note that except for
, all entities allow breaking. Whatever text surrounds them will wrap to a new line if it would otherwise extend beyond the container boundary. With
it would wrap to a new line as a block even if the text before
could fit on the previous line.
Depending on your use case, that may be desired or undesired. For me, unless I'm dealing with things like names (John
Doe), addresses or references (see eq.
5), breaking as a block is usually undesired.