In this article, you can learn what is a markdown file and how to write the markdown file. Most of the times you can find this file in the remote repository.
What is readme.md file?
It is a simple plain text file that contains the basic information of the files and some guides. It is used to write some installation guide or basic documentation inside the project directory. Most popular repository providers like GitHub, gitlab and bitbucket are using the readme.md file as a file descriptor.
What is markdown?
Markdown is a scripting language that is very lightweight. It is used to format plain text to a respective design. Markdowns are rapidly used in content writing in some blog post web sites. It converts some plain text to the desired format in HTML. The simplicity and easy to understand is making the markdown more popular. It takes all the text from the markdown file and converts to HTML through a markdown app or a compiler.
If you are a beginner to markdown file then this article is for you. I am going to write a readme.md file so that you will have a better understanding of the markdown script.
Here I am using visual studio code IDE for writing markdown file. Below are the steps to create a markdown file in visual studio code.
Step-1: Open visual studio code and goto file > new file
Step-2: Name the file as readme.md or readme.markdown and save the file.
Step-3: Find and click the ?open preview to the side? icon.
Step-4: Start writing the script.
Headings
For writing headings, you have to add hash # symbol at the beginning of the line. The number of the hash symbol will increase heading type will change according to that.
markdown headings
You can write up to Heading 6.
Normal text
If you want to write normal text then write simple text here, no need to add any tags it will automatically convert into text.
You can write simple text in a markdown file
Hyperlinks
You can add a hyperlink in a markdown file by using the below tag.
[link name](targetURL)
e.g. [Github](https://www.github.com)
You can also write link title (While hovering over the link the title will appear)
[link name](targetURL “Link title”)
e.g. [Github](https://www.github.com “Github home”)
note: Make sure a single space should be their between targetURL and title)
Strong and italic text
You can write strong and italic text by appending underscores _ before and ending of the line, for italic text add double star ** before and ending of the line for strong/bold text.
_Italic text here_
StrikeThrough
If you want to strike through a word or line then add two tilde symbol at the beginning and end of the line.
~~Strikethrough text~~
Images
You can add images in a markdown file by using the below tag.
![imagename](TargetUrl)
Tables
You can write a table by using the below format of text.
|Name|Email|Address| <====== This is the heading of the table|—-|—–|——-| <====== This is the separator.|John|[email protected]|Address1| <=== This is the table body.
Quotes
If you want to write quotes the just add a > symbol at the beginning of the line.
>Your quote looks like this.
Code
You can write code by appending ` symbol at the beginning and end of the line.
Code block
If you want to write a block of code then add “` at starting and ending of the code.
You can specify your language after the “` at starting of the line.
“`Languageyour code“`
List
You can write an ordered list, unordered list, and mixed list. Please see the below format how to write a list.
1. Item 12. Item 23. Item 3 * Sub item 1 * Sub item 3* Unordered item* Unordered item* Unordered item
Horizontal line
If you want to add a horizontal line in the markdown file then simply add — or ***
Note: *** is for thicker line.