Intro
Markdown is a light Markup language for formatting text and more readable content. It’s easy to learn, and you will not regret it after learning it.
If you are a content writer or a programmer who needs to write documentation or tech content on your website, you might have to learn it. A most popular site like Github uses Markdown for formatting. And also, Github has its extended version of Markdown.
For practice, you can check the following online markdown editor link.
Markdown has a pretty small amount of basic syntax to learn. Let see.
Heading
To make a heading, you have to put # before it. If you know HTML, you can think of it as a heading tag. In HTML, there are six different heading tags. H1 is the largest. Markdown’s heading tags are kind of similar to HTML. But here, we will use # instead of h1, ## instead of h2, etc. # is for the largest heading.
See the following example.
# Heading One ## Heading Two ### Heading Three #### Heading Four ##### Heading Five ###### Heading Six
If you want to write a paragraph, you don’t need any syntax. Just write it as a normal text.
Bold and Italic Text
To make a text bold, you just put ** before and after the text. You can do it another way. For that, we have to __ before and after the text.
Let’s see the example.
Example One **Markdown** is a language for formatting text. Example Two __Markdown__ is a language for formatting text.
Italic formation is also simple, and it’s almost similar to bold text formation. But this time, we have to put one * before and after the text. Or we can put one _ before and after the text.
Example One *I am italic* Example Two _I am Italic_
Strikethrough Text
Often we have to show strikethrough text. To show strikethrough text, we have to use the tilde (~) character before and after the text. Let’s see.
Life is ~not~ beautiful.
Blockquote
We often have to use blockquote in our content. To use a line of text as a blockquote, we have to put a Greater-than sign (>) before the content.
> Think twice, code once.
Horizontal Line
If you want to divide your content using a horizontal line, you can easily do it using simple Markdown syntax. For that, use three underscores or three hyphens. Let’s see.
Example One ___ Example Two ---
Unordered/Ordered List
Writing a list of something is common in content creation. So, how can we display it in a formatted way using Markdown? It’s pretty simple. Just put a hyphen (-) before every list item. Make sure there is a space between the hyphen and the text. This is for an unordered list. See the following example for a clear understanding.
- List Item One - List Item Two - List Item Three #### Nested List - List Item One - List Item Two - One - Two - Another List - List Item Three #### Another way of writing a list * List Item One * List Item Two * List Item Three
Creating an Ordered list is similar to the unordered list. Here we use numbers instead of hyphens or asterisks. Let’s see.
1. List Item One 2. List Item Two 3. List Item Three
Or just put 1. before each list item. Markdown will increase the list number automatically.
Image
Displaying images is a crucial part of content creation. See the following syntax for displaying an image in your content:
![alt text](image link)
See the following example.
![Google Logo](https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/368px-Google_2015_logo.svg.png)
Link
The syntax is simple to create a link text. Here it is: [text](link, title)
. The Text part is the text which we want to show as a link. And inside parentheses, we have to put the link. The title is optional, this is for displaying the given title when we hover on the link. We can ignore it.
[Google]('https://google.com', 'Google')
Code
If we need to show code block to demonstrate some examples in our content, we can also do it using Markdown. For that, we have to use backtick. There is a difference between single-line code and multiline code. Let’s see both.
#### For single line code `print('Hello World')` #### For multiline line code ``` def add_two_number(a, b): return a + b result = add_two_number(1, 1) ```
Conclusion
These are the basics syntax of Markdown. Don’t forget to practice. You can also see the output of the given example code by writing it yourself.
These are not so difficult to understand. I hope you got the idea.