Getting Started¶
-
Markdown is a lightweight markup language that you can use to add formatting elements to plain text documents.
-
When You create a Markdown-formatted file, you add Markdown syntax to the text to indicate which words and phrases should look different.
Why Use Markdown?¶
How Markdown Works?¶
-
When you write in markdown, the text is stored in a plaintext file that has an
.md
or.markdown
extension. -
Markdown Applications use something called a Markdown Procecssor to take the Markdown-formatted text and output in to HTML format.
-
Basic Syntax¶
Heading¶
-
To create a Heading, add number signs4 (#) in front of the word or phrase.
-
The number of number signs you use should correspon to the heading level.
Markdown HTML Output # Heading level 1 # Heading level 2 # Heading level 3 # Heading level 4 # Heading level 5 # Heading level 6 -
You can also use
==
on the line below the heading text for heading level 1 and–
for heading level 2. -
For compability, it is recommended to put a space between the # and the heading text.
Paragraph¶
-
To create a paragraph, use a blank line to separate one or more lines of text.
This is the first Paragraph This is the second Paragrarph
This is the first Paragraph
This is the second Paragrarph
Line Breaks¶
-
To create a line break, end a line with two or more spaces, and then type rerturn(press Enter key).
-
You can use two or more spaces followed by enter-key for line breaks in nearly every markdown application.
Emphasis¶
-
You can add Emphasis by making the text bold or italic.
Bold¶
-
Two asterisks before and after a word or phrase. Example
*Bold**
> **BOLD -
You can also use two underscores (_) together to make text bold, but it is not recommended for compatibility reasons.
Italic¶
- One asterisk before and after a word or phrase. Example,
italic*
-> italic - You can also use an underscore before and after the word or phrase, but again it isn’t recommended for compatibility reasons.
- You can do both italic and bold at the same time by doing the following
**this is Italic and Bold!***
-> this is Italic and Bold!
-
-
Again you can use three underscores, but just don’t duh!
BlockQuotes¶
- To create a blockquote, add a
>
in front of a paragraph.
This is a blockQuote for example.
-
Blockquotes can also contain multiple paragraphs. Add a
>
on the blank lines between the paragraphs.Nested Block Quotes¶
- Add a
>>
in front of the paragraph you want to be nested
Hi this is blockQuote again
This is a nested Block Quote now!
Did you know block quotes can contain other markdown elements as well!
Like, The above one was Heading, this is italic and this is bold within markdown.
- Add a
-
It is a good practice to have blank lines before and after block quotes for compatibility and improving the readability.
List¶
Ordered Lists¶
- To create ordered list, add line items with numbers followed by periods.
- Example,
- first
- second
- third
- To nest elements into a list add
4 spaces
or1 tab
indent- one
- 1.5
- 1.6
- two
- three
- one
Unordered Lists¶
- To create an unordered list, add dashes(-), asterisk(*), or plus signs(+) in front of line items.
- If you ever need to start an unordered list with a number followed by a period, you can use a backslash() to escape the period.
-
- A great Year (Using escape character)
- A great year (Not using escape character)
-
Code Blocks¶
-
Code blocks are normally indented four spaces or one tab.
-
When they’re in a list, indent them eight spaces or two tabs.
<html> <body> hi </body> </html>
Code¶
- Denote a word or phrase as code, enclose it in backticks (`)
- To escape backticks, you can either enclose the whole phrase or word containing the backtick into two backticks, or use the escape character with the backtick.
Horizontal Rules¶
-
To create a horizontal rule, use three or more asterisks (***), dashes(—) or underscores(___) on a line by themselves. Example
-
For better compatibility you should put blank lines before and after horizontal rules.
Links¶
-
To create a link, enclose the link text in brackets, then follow it immediately with the URL in parentheses. Example: Github
- You can also add title to the links Linkedin
URLs and Email Addresses¶
- To quickly turn any URL or email address into a link, encloseit in angle brackets. Example: dhondpratyay@gmail.com
Formatting Links¶
- To emphasize links, add asterisks before and after the brackets and parentheses. Example: Linkedin
- To denote linsk as code, add backticks in the brackets. Example:
[Github](<https://github.com/PratyayDhond>)
Reference Style Links¶
(This is a bit complex but sure interesting)
-
Reference-style links are a special kind of link that make URLs easier to display and read in markdown.
-
The first part of a reference-style link is formatted with two sets of brackets. ([][])
- The first set of brackets surrounds the text that should appear linked.
- The second set of brackets displays a label used to point to the link you’re storing elsewhere in your document.
- Syntax ->
[DisplayName][label]
-
Example -> GitHub
- The second part of a reference-style link is formatted with the following attributes:
-
The label, in brackets, followed immediately by a colon and at least one space.
- The URL for the link, which you can optionally enclose in angle brackets.
- The optional title for the link, which you can enclose in double quotes, single quotes, or parenteses.
Example ->
[1]: <https://github.com>
but you have to make sure that the label-link is in the scope for referencing.
Images¶
-
To add an image, add an exclamation mark (!), followed by alt text in brackets, and the path or URL to the image asset in parenteses.
Linking Images¶
-
To add a link to an image, enclose the Markdown for the image in brackets, and then add link in parentheses.
-
Characters You can Escape!¶
Character | Name |
---|---|
|backslash | |
` | backtick |
* | asterisk |
_ | underscore |
{} | curly brackets |
[] | brackets |
<> | Angular bracket |
() | parentheses |
# | hashtag (pound sign) |
+ | plus sign |
- | minus sign |
. | dot |
! | exclamation mark |
Extended Syntax¶
Tables¶
-
To add a table, use three or more hyphens to create each column header and use pipes (|) to separate each column.
-
Example:
Column 1 Column 2 XD XC Alignment¶
- You can align text in the clumns to the left, right or center by adding a colon(:) to the left, right, on on both side of the hyphens within the header row.
Syntax: | Heading 1 | heading 2 | Heading 3| | :-- | :-: | --: | | left | center | right |
Output:
Heading 1 heading 2 Heading 3 left center right
Fenced Code Blocks¶
-
Depending on your Markdown processor or editor, you’ll need to use three backticks (```) or three tidles (~) on the lines before and after the code block7.
-
Syntax:
{ firstName: “Pratyay”, lastName: “Dhond”, }
-
Output
{ firstName: "Pratyay", lastName: "Dhond", }
-
To add syntax highlighting, specify a language next to the backticks before the fenced code block.
code goes here
Escaping Pipe Character¶
- You can display a pipe character (|) in a table by usin gits HTML character code
(|)
Footnotes¶
-
Footnotes allow you to add notes and references without cluttering the body of the document.
-
To create a footnote reference, add a caret(^) and an indentifier inside brackets. Example [^1].
-
Identifiers can be numbers or words but they cannot contain spaces ir tabs.
-
After creating a footnote reference, you have to add the footnote using another caret and identifier inside brackets with a colon and text Example:
[^1]: This is the first footnote. Yayy
-
You don’t have to put footnotes at the end of the document. You can put them anywhere except inside other elements like lists, block quotes, and tables.
Strikethrough¶
- This feature allows ou to indicate that certain words are a mistake not meant for inclusion in the document.
- Use a tilde symbols before and another one after the words/phrases
- Example
Stack~Under~OverFlow
-> Stack~Under~OverFlow
Task Lists¶
- Task Lists allow you to create a list of items with checkboxes.
- To create a task list, add dashes (-) and brackets with a space([ ]) in front of task list items.
- To select a checkbox, add an ‘x’ in between the brackets ([x])
- Syntax:
- Task 1
- Task 2 (Completed)
- Output:
- Task 1
- Task 2 (Completed)
FootNotes for the article¶
- People use Markdown to create documents, websites, notes, books, emails, technical documentations, etc. ↩ ↩2
- Even if your application stops working in the future, you’ll be able to access your markdown files using any other text editor. ↩
- Markdown Processor is also commonly referred as a “parser” or an “implementation”. ↩
- Number signs is what the author referred it to, I still prefer Hashtags. ↩
- Commonly referred to as ‘trailing whitespace’ ↩
- As using underscore for texts like
'hi__thisisBold__suddenly'
might or might not be supported in certain editors. ↩ - Or maybe both of them will just work fine :) ↩
Go Deeper:¶
- I thought, why not add more to do this since I almost use this daily now. So following data is not from the book/book-review.
- But it is what I have come across and had to google to know.
Markdown Maths¶
¶
Overset
- Have two symbols over each other
\overset{symbol_on_top}{base_symbol}
- \(\overset{+}{\Rightarrow}\)
AND
\land
\(\rightarrow\) \(\land\)
- Divides (P | Q)
- \(p\mid q\) \(\rightarrow\)
p \mid q
- \(p\mid q\) \(\rightarrow\)
- Does not Divide (\(p \centernot\mid q\))
p \centernot\mid q
- can also use
p \nmid q
to get \(p \nmid q\)