Quick Reference to Markdown Syntax

Markdown

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.

Indentation example in Markdown
Indentation with   (Click to enlarge)

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.

πŸ’‘
Want to learn Markdown? Refer to our Markdown beginner's guide to explore.

Adding Indentation Using 4 Spaces With Lists

List indentation in Markdown
Indentation with lists (Click to enlarge)

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:

List indentation in Markdown
Indentation with lists using Tab and spaces (Click to enlarge)

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 πŸ“–

How to Add Bold and Italic Text in Markdown
Learn how to emphasize text in Markdown by adding bold and italics texts.

Using Indentation With Blocks

Indentation with a blockquote under a list (Click to enlarge)

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 πŸ“–

11 Best Markdown Editors for Linux
Markdown is a simple markup language. It’s lightweight and easy to learn. If you haven’t seen any markdown document yet, just head over to GitHub and enter any open-source project. The README file almost certainly will be written using Markdown. Basically, you use some β€˜code’ before your text

I hope this quick tip with indentation helps you create better Markdown documents. Share your thoughts in the comments below.