Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab space in Markdown

I want to use one/multiple Tab space in Markdown. I used, "    &nbsp", which is working. But if i want to use multiple Tab space, then MarkDown Document will not look good.

I wanted to use like this below,

Main Topic
*Tabspace* Subtopic1
*Tabspace**Tabspace* Some Points for subtopic1
*Tabspace* Subtopic2
*Tabspace**Tabspace* Some Points for subtopic2 

Actual look should be

Main Topic
    Subtopic1
        Some Points for subtopic1
     Subtopic2
        Some Points for subtopic2

Any other alternative for &nbsp

like image 352
Jeanbaye Avatar asked Oct 13 '16 13:10

Jeanbaye


People also ask

How do you indent a block of text in Markdown?

Code Blocks To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab. For example, given this input: This is a normal paragraph: This is a code block.

What is &nbsp in Markdown?

Another option, if your Markdown processor supports HTML, is to use the HTML entity for non-breaking space (   ).

How do you keep Markdown spaces?

In github markdown inline code blocks (possibly other places) you can use <code>&nbsp;</code> to preserve spaces, instead of using backticks.


1 Answers

Use non-breaking spaces

In Markdown, as any markup languages, the tab space collapses to a single space. Also, several consecutive horizontal whitespace (e.g. spaces, tabs) collapse to a single space or they are removed from the beginning of a paragraph.

Instead of a tab space you must use several non-breaking spaces:
"a space character that prevents consecutive whitespace characters from collapsing into a single space, and also prevents an automatic line break at its position".

Example

   This line uses     non-breaking     spaces in many places; they    are not   collapsed.
This line uses many consecutive spaces in many places; they are all collapsed.

The beauty of this solution is that you don't need to use any code in your Markdown document (in HTML you must use &nbsp;).

How to introduce a non-breaking space?

  • In macOS, you need to press ⌥ Opt+Space
  • In Windows, sometimes work Alt+0+1+6+0 or Alt+2+5+5
  • In many commercial software Ctrl+Space

Solution to the question example

Main Topic

    Subtopic1
        Some Points for subtopic1
        Some Points for subtopic1
        Some Points for subtopic1

    Subtopic2

    Subtopic3
        Some Points for subtopic3
        Some Points for subtopic3
        Some Points for subtopic3

Warning
Copy and paste the previous example could not work because sometimes the system change non-breaking spaces to normal spaces in a copy-paste operation :‑(.

like image 157
ePi272314 Avatar answered Sep 20 '22 17:09

ePi272314