Adding Indentation in Markdown
Here's how you can add indentation in Markdown documents.
Indentation refers to adding space before a text or a line. These days, it is particularly helpful in writing easy-to-follow programs.
In some rare cases, you may want to write text with indentation. It can help you organize or structure your Markdown document providing clarity.
There is no Markdown-specific syntax to it. But you can use HTML notations to add indentation in Markdown.
Here are various ways to add indentation in Markdown:
- Using four spaces
- Using Tab
- Using > (greater than)
- Using or  
You can add hard spaces, press tab key, or refer to various other methods to add indentation in a Markdown document.
For instance, if you have a list in your Markdown document with sub-points, you can add an indentation to denote the child lists and keep them separate from the parent list.
Adding Indentation With or  
While this may not be the cleanest/most efficient way to add indentations to your document, it sure works. You must add the before your text or sentence to add a visible space:
This is the example line.
stands for non-breaking space that adds spaces between both sides. This is a character that renders space for HTML view.
So, adding to the start of a word or sentence will not have an impact. You might want to use the quickest way to add a new line in Markdown along with this for a faster experience.
Similarly, you can replace it with   to add e-n size spaces, visually acting as two regular spaces.
You are using another markup language to add a space here. It should work, but the Markdown document that makes it possible may look a bit ugly as per your requirements.
Adding Indentation Using 4 Spaces With Lists
4 spaces add one level of indentation. You can test this out when you want to create sub-level of lists.
Here's what the Markdown code looks like:
- List
- List 2
- Sub-level list 1 with four spaces
- Sub-level list 2 with four spaces
Of course, you must know how to create nested lists in Markdown before incorporating indentation.
Adding Indentation Using Tab With Lists
Instead of 4 keystrokes, you need to press the Tab key once, and that's it.
The Tab key should be handy when adding more spaces, like adding a third sub-level in a list.
Here's what it looks like:
The Markdown code for it looks like this:
- List
- List 2
- Sub-level list 1 with four spaces
- Sub-level list 2 with two tabs
Suggested Read π
Using Indentation With Blocks
Note that > does not add an indentation but a blockquote.
The line must be indented if you need to add a blockquote within a list item.
Just like this:
* List item example
>blockquote with indentation using 4 spaces
Indentation Keeps it tidy
It might sound like a small thing in a Markdown document. But indentation helps structure your sentences and lists to provide a clean layout.
Suggested Read π
I hope this quick tip with indentation helps you create better Markdown documents. Share your thoughts in the comments below.