Markdown Tutorial
Markdown Guide
Basic syntax: https://www.markdownguide.org/basic-syntax/#horizontal-rules
Comments
<! --# Comments go here -->
Equations
Typora support TeX-style references.
Here is a labeled equation: \(x+1\over\sqrt{1-x^2} \label{ref1}\tag{1}\) This is a reference : $\eqref{ref1}$
Here is a labeled equation:
$$
x+1\over\sqrt{1-x^2}\label{ref1}\tag{1}
$$
This is a reference : $\eqref{ref1}$
Tables
To add a table, use three or more hyphens (---
) to create each column’s header, and use pipes (|
) to separate each column.
Cell widths can vary, just use different relative length of hyphens.
| Syntax | Description |
| --- | ----------- |
| Header | Title |
| Paragraph | Text |
You can align text in the columns to the left, right, or center by adding a colon (:
) to the left, right, or on both side of the hyphens within the header row.
Bullet list
You can make a bulleted list by starting each line with a -
or *
or +
character followed by a space. You can make a numbered list by starting each line with a 1.
followed by a space.
Markdown need an Empty line before a list.
` This will not work`
* Item 1
* Item 1
* Item 1
Identation is essential to bullet lists in markdown as it indicates bullet levels.
You can make a nested section of a list by adding two spaces before the bullet or number character.
- four spaces or one tab work before the bullet too.
- It is possible to add one blank line between different levels to increase readability.
* unordered list
+ sub-item 1
+ sub-item 2
- sub-sub-item 1
- unordered list
- sub-item 1
- sub-item 2
- sub-sub-item 1
-
You can still indent a paragraph even if you don’t need a new bullet point. The indentation indicates that this paragraph belongs to the preceeding point.
- You can also nest other elements like blockquotes or code blocks.
1. Ingredients - spaghetti - marinara sauce - salt 2. Cooking Bring water to boil, add a pinch of salt and spaghetti. Cook until pasta is **tender**. 3. Serve Drain the pasta on a plate. Add heated sauce. > No man is lonely eating spaghetti; it requires so much attention. Bon appetit!
-
Ingredients
- spaghetti
- marinara sauce
- salt
-
Cooking
Bring water to boil, add a pinch of salt and spaghetti. Cook until pasta is tender.
-
Serve
Drain the pasta on a plate. Add heated sauce.
No man is lonely eating spaghetti; it requires so much attention.
Bon appetit!
- If list items are separated by blank lines, Markdown will wrap the items in
<p>
tags in the HTML output.
Horizontal rules
To create a horizontal rule, use three or more asterisks (***
), dashes (---
), or underscores (___
) on a line by themselves.
- The rendered output of all three looks identical.
***
---
_________________
- For compatibility, put blank lines before and after horizontal rules.
✅ Do this | ❌ Don’t do this |
---|---|
Try to put a blank line before… — …and after a horizontal rule. |
Without blank lines, this would be a heading. — Don’t do this!` |
Backquotes
To create a blockquote, start a line with greater than >
followed by an optional space.
- To keep the quote in one block, blank lines inside the quote must contain the
>
character.
Links
[text](https://url)
create a text linked to the url in parentheses.
To quickly turn a URL or email address into a link, enclose it in angle brackets.
<fake@example.com>
will show like fake@example.com
Note that urls in markdown cannot handle special characters, such as space, parenthesis, pipes. It is suggested to use a html tag <a href="">link</a>
if your markdown supports html. Otherwise, need to
- replace space with
%20
- replace parenthesis with
%28
Reference-style links use a second set of square brackets [text][id]
, inside which you place a lable of your choosing to identify the link.
Q: Why we use reference-style links?
A: Aim to not mix text with long urls to make the text easier to read.
[id]
is a label used to point to the link you define somewhere else in your document, usually end of file to keep your text easier to read.
This is an example of referenc link: **[text][id]**.
This is an example of referenc link: text.
Link definition
The link definition can be placed anywhere after a blank line, but is generally near the bottom. You can also put them immediately after each paragraph in which they’re used.
Definition identifiers may consist of letters, numbers, spaces, and punctuation. They are not case sensitive.
Then, anywhere in the document, you define your link label like this, on a line by itself:
[id]: http://example.com/ "Optional Title Here"
- put your label in square brackets, followed immediately by a colon and at least one space.
- write your url for the link, which you can optionally enclose in angle brackets, e.g.,
<http://example.com/>
. - you can specify an optional title, enclosed in double quotes, single quotes, or parentheses. It is a reminder of yourself what the website is about.
The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:
[Google][]
And then define the link:
[Google]: http://google.com/
- Link names may contain spaces.
Phone and email links
Call me [Call Me!](tel:1111111)
using markdown or <a href="tel:1111111">Call Me!</a>
using html.
example@example.com [example@example.com](mailto:example@example.com)
or <a href="mailto:example@example.com">example@example.com</a>
Internal Links
-
link to title
You can use
#
to create links towards any headings in your markdown file.# This is a title ... ... ... A [link](#this-is-a-title) to jump towards target heading
-
link to named anchor
You could also write named anchors using raw HTML.
- Source: the target text to which you want to link to, place the following tags before the text:
<a id="name-of-anchor"></a>
or<a name="name-of-anchor"></a>
If the source is a heading, then use
<h2 name="name-of-anchor">Level 2 heading</h2>
- Reference:
- Use html style tags
<a href="#name-of-anchor">Link to Anchor</a>
to link to the target text. Or, [Link to Anchor](#anchor)
pure markdown
- Use html style tags
Use
command + click
to jump to target headings, or open them in Typora, or open in related apps.<a id="anchor"></a> Anchor <a href="#anchor">Link to Anchor</a>
- Source: the target text to which you want to link to, place the following tags before the text:
The point of reference-style links is not that they’re easier to write. The point is that with reference-style links, your document source is vastly more readable.
Typeface
Format | Quoted by |
---|---|
bold | **text** (text) |
italic | *text* or _text_ (text) |
bold and italic | ***text*** (text) |
stikethrough | ~~text~~ ( |
Start a new line without starting a new paragrah.
\
or place two empty spaces at the end of a line␣␣
, followed by a soft enter, i.e., shift + Enter. Or,- html tags
<br />
or
Insert a blank line
To create vertical space/ a blank line, use
(followed by a blank line).
Use html entity code to add special characters in Markdown
|checked|unchecked|crossed|
|---|---|---|
|✓|_|✗|
|☑|☐|☒|
checked | unchecked | crossed |
---|---|---|
✓ | _ | ✗ |
☑ | ☐ | ☒ |