Markdown is a way of writing and formatting rich text using plain text formatting syntax. Basically, it is a lightweight markup language, using which we can create richly formatted text. The main intention behind its invention was to provide users with a markup language, that would appeal to its readers, even in its source code form, and thus make text formatting easier.
In this cheat sheet, we will discuss some of the major features of markdown along with the code syntaxes and examples which will allow the reader to make richly-formatted text articles by themselves.
1. Markdown Files
A text file created with several syntaxes of a Markdown language is called a Markdown File. It makes use of plain text formatting consisting of inline text symbols for specifying how a text can be formatted.
How to open a markdown file offline?
Markdown files are of the extension "*.md" where * represents the file name. They can be opened offline using certain Chrome plugins like the “Markdown Preview Plus”. Visual Studio Code by Microsoft also allows the user to toggle between Markdown code and its preview. Or you can simply open it using Notepad/Notepad++ or WordPad software.
Online Markdown Editors:
There are many online Markdown editors in the market currently, which have soared in popularity due to their easy use case and a wide variety of features available. Some of the most popular ones are HackMD and StackEdit, which provide many features along with basic markdown, to render richly formatted content.
Advantages of Markdown Files:
Some of the advantages of Markdown are stated below:
- Richly Formatted content can be created relatively quickly.
- It has become the go-to language for creating documentation, because of its lightweight and platform-transferrable nature. Even Github readme files are created using Markdown, allowing them to be attractive to read(due to formatting) as well as lightweight in nature.
2. Markdown Headings
Headings tell us about the title or subject of a piece of work. In markdown, there are 2 main ways to write headings both of which are discussed below:
- Headings using #:
We can write headings in markdown using the # symbol, followed by the heading that we want to write. The number of ‘#’ symbols indicate the size of the header. More the number of ‘#’ symbols, smaller the font size of the header. There are a total of 6 types of headers available in markdown.
Example:
# Heading1
## Heading2
### Heading3
#### Heading4
##### Heading5
###### Heading6
Output:
- Using HTML syntax:
We can also write headers using HTML formats using <hi></hi> (where i varies from 1 to 6, and it represents the size of the headers, from large to small) tags.
Example:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Output:
3. Text Styles
We can use markdown to change the styles of selected text to different styles like bold, italics, blockquotes, underline, strike-through, etc.
- Markdown Bold:
- We can make a text bold by enclosing the text between 2 * symbols as -> **text**.
- We can also make it bold using the HTML “strong” tags.
- For example:
Method 1:
*Hello*
Method 2:
<em>Hello</em>
Output:
- Markdown Italics:
- We can make a text Italics by enclosing the text in single * symbol as -> *text*.
- We can also make it in Italics using the HTML “em” tags.
- For example:
Method 1:
*Hello*
Method 2:
<em>Hello</em>
Output:
- Markdown Blockquotes:
- Blockquotes are used to indicate that the enclosed text is an extended quotation. Blockquotes are written in markdown using > symbol. Multiple > can stacked together to get nested blockquote.
- Example:
> This is a blockquote.
>> Nested blockquotes.
>>> More nesting.
Output:
- Markdown Underlined:
- We can underline a piece of text in Markdown using the HTML “ins” tag.
- Example:
<ins>This is an underlined text</ins>
Output:
- Strike-through:
- We can strike-through a piece of text in Markdown by enclosing the text inside double ~ symbol as -> ~~text~~.
- Example:
~~The text is struck~~
Output:
- Markdown Boxed:
- “Boxed” allows us to form a box around our given piece of text to highlight its importance. It can be formed with using the “table”, “tr”, and “td” tags in conjunction, similar to using HTML tables.
- Example:
<table><tr><td>The quick brown fox jumps over the lazy dog.</td></tr></table>
Output:
- Markdown Superscript and Subscript:
- Superscript or Subscript are characters that are set slighly above or below the normal line of text. We can set them using the “sup” or the “sub” HTML tags respectively.
- Example:
Subscript <sub>Example.</sub>
Superscript <sup>Example.</sup>
Output:
1 Comments