I'm struggling to add empty spaces before the string starts to make my GitHub README.md
looks something like this:
Right now it looks like this:
I tried adding <br />
tag to fix the new string start, now it works, but I don't understand how to add spaces before the string starts without changing everything to
. Maybe there's a more elegant way to format it?
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 backticksAs a workaround, you can use a code block to render the code literally. Just surround your text with triple backticks ```. It will look like this:
2018-07-20 Wrote this answer Can format it without Also don't need <br /> for new line
Note that using
<pre>
and<code>
you get slightly different behaviour: 
and<br />
will be parsed rather than inserted literally.<pre>:
<code>:
2018-07-20 Wrote this answer Can format it without Also don't need
for new line
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 yourREADME.md
. The spaces at the start of the lines are em spaces.You can use
<pre>
to display all spaces & blanks you have typed. E.g.:After different tries, I end up to a solution since most markdown interpreter support Math environment. The following adds one white space :
And here ten:
Markdown gets converted into HTML/XHMTL.
HTML is completely based on using
for adding extra spaces if it doesn't externally define/use JavaScript or CSS for elements.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
instead of using 10
one after one as the below oneFor more details check