What is markdown ??
Markdown is a markup language for formatting text using simple syntaxes. It is widely used for blogging, websites, comment management services, readme files, and documentation. Unlike HTML, markdown doesn't have tags to define structure and features. The markdown syntaxes are combinations of special characters with plain texts.
In this article, we will discuss a list of markdown syntaxes you will use most of the time. It will probably cover the 99% of cases you need markdown. We will learn the syntaxes and how the syntax will render on the browser.
Headings
Headings
and Subheadings
are the most used tags which we used and is also the basic need of any documentation. The syntax for the heading is to place a #
before writing anything and we have to give the space between the # and the text otherwise it will not work we have different types of heading as we know from h1
to h6
so to use it we have to increase the number of #
.
For example :
# H1 -Heading 1
## H2 -Heading 2
### H3 - Heading 3
##### H4 -Heading 4
Here goes the output of the heading syntaxes.
Heading 1
Heading 2
Heading 3
Heading 4
Code and Syntax Highlighting
If we have to highlight a certain text or something else in between the paragraph or anywhere we can do this with the help of this symbol (``).
Example
I `write` code.
Put the word or anything between the back-ticks.
output
I write
code
List Items
In Html we have two types of list available to us one is unordered and the other one is ordered .
Unordered List
To create an unordered list of items you can use the hyphen(-) and space as a prefix to the list item, as shown below:
- Milk
- Curd
-Tea
It will output a bulleted unordered list like this:
Milk
Curd
Tea
The alternate way to write the unordered list is to use the asterisk(*) as shown in the below:
* Milk
*Tea
*Curd
It will output a bulleted unordered list like this:
- Milk
- Tea
- Curd
ordered list
You can write 1
before writing the text and give a space for the ordered list.
1. Milk
1. Tea
1. Curd
Output
1 Milk
2 Tea
3 Curd
We can also write nested Items as well.
1. Curd
1. Tea
1. Apple
1. Banana
1. Coffee
1. Mango
Output
- Curd
- Tea
- Apple
- Banana
- Coffee
- Mango
Same as for unordered list.
Code Block
To display any block of code, simply wrap the code block within this symbol (`) thrice.
It is a code block. we can create code syntaxes of Python, C++, JavaScript and many more.
If you want to use any language just put the Language name after the end of the starting backtick.
console.log("this is a JavaScript code");
Strikethrough Text
To make a text appear like it is striking through, you need to enclose it within 2 (s).
<s>Sharing is NOT about Caring.</s>
Output
Sharing is NOT about Caring
Blockquotes :
To create blockquotes, add >
in front of a paragraph.
> Learn markdown syntax to create beautiful readme files
Output:
Learn markdown syntax to create beautiful readme files
Bold
You need to use two asterisks(**) symbols as a prefix and a suffix to highlight a text as bold.
** Learn code Online **
Output:
Learn code Online
Italic
You need to use one asterisk(*) symbol as a prefix and suffix to highlight a text as italic.
*Learn code Online is a online learning platform*
Output:
Learn code Online is a online learning platform
Link
Linking is a very important feature to link the document, files and images in a file it is widely used.
Syntax:
[LINK_TEXT](LINK_URL)
Example for using the above text
Online Learning Platform [Learn Code Online](https://courses.learncodeonline.in/learn)
Output:
Online Learning Platform Learn Code Online
Images
The syntax of rendering an image is almost similar to linking a URL we learned just now. You need to place the ! before writing the Link syntax.
Example
![Link_text](image_path)
![GreenRoots Blog](https://res.cloudinary.com/atapas/image/upload/v1598936159/profile/500x500_oklccx.png)
The output:
Horizontal Line
The syntax to get a horizontal line is by specifying 3 or more consecutive hyphens(-) or arsterisks(*) or underscore(__).
---
******
______
Output:
Table
To create Tables, we can use three or more hyphens to create a header for each column (---), and separate those columns using pipes (|)
| Fruit | Price |
|------|-------|
| Mango| 90Rs|
| Apple | 80Rs|
Fruit | Price |
Mango | 90Rs |
Apple | 80Rs |
Line break :
For Line break, we can use a br
after the end of the line and then we can move to the next line writing our texts.
Hello <br>
world
Output:
Hello
World
That's all for now. You've made it. you've covered almost everything you need to know about markdown syntax.