Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
898 views
in Technique[技术] by (71.8m points)

syntax - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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 :?(.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...