Markdown syntax
Italics and Bold
e.g.
This is italicized, and so is this.
This is bold, and so is this.
Use italics and bold together if you have to.
NB: triple * doesn't seem to work in the nvALT preview, nor in MOU. But triple underscore works as advertised in both.
Linebreaks
End a line with two spaces to add a <br/>
linebreak:
e.g.
How do I love thee?
Let me count the ways
Code and Preformatted Text
Indent four spaces to create an escaped <pre> <code>
e.g.
printf("%d\n", 42); /* what was the
question again? */
Inline code is by using backtick.
e.g.
One can try inline code is in here
Blockquotes
Right angle brackets > are used for block quotes.
This is a blockquote.
This is the second paragraph in the blockquote. This is another line, but is part of the previous line in HTML unless linebreak is used.
<br>
This is an H2 in a blockquote
Body text
This is a very very long paragraph. I want to see how indents work with this. This is a very very long paragraph. I want to see how indents work with this.
Normal paragraph
Code blocks (pre-formated blocks of texts)
aka "Block Code"
This is in plain text
This is another line in plain text
And this is inline code
.
Horizontal Rules
Insert a horizontal rule
by putting three or more hyphens, asterisks, or underscores on a line by themselves:
e.g.
e.g.
e.g.
e.g.
NB:
Remember to leave an empty line above and below
Lists
Lists have have a empty line above and below.
Numbered lists (or ordered lists)
(Actual numbers do NOT matter, as long as they are numbers)
- Red
This is a second line of the bullet point (break by 2 trailing spaces in the preceding line) - Green
- Blue
- Yellow
- Sub-item
- Sub-item
- Sub-item
- White
- Sub-item
- Sub-item
- Sub-item
- Grey
Unordered lists
- Red
This is a second line of the bullet point (break by 2 trailing spaces in the preceding line) - Green
- Subitem
- Subitem
- Blue
- Item1
- Item2
- Item3
- Yellow
Can use as a bullet:
- A minus sign
- Plus sign
- Asterisk
Mixing
Cannot mix ordered and unordered lists at the same level
Ok to mix if they are different levels (see above examples)
e.g.
- Item 1
- Item 2
- Item 3
- Item 4
The above will be rendered as one big unordered list
e.g.
- Item 1
-
Item 2
-
Item 3
- Item 4
The above will be rendered as one big unordered list, even with empty lines in between. But the list will have bigger line-spacing in between items.
Solution:
- Item 1
- Item 2
Another list:
- Item 3
- Item 4
The above will be two separate lists.
Headers
Underline text to make the two <h1> <h2>
top-level headers :
Header 1
========
Header 2
--------
Or use #
for leve 1 to 6 headers:
e.g.
# Heading level 1
Body text
## Heading level 2
Body text
### Heading level 3
Body text
#### Heading level 4
Body text
##### Heading level 5
Body text
###### Heading level 6
Body Text
Automatic linking
Enclosing urls and email address in angle brackets.
NB:
URLs can be relative or full.
Links
There are three ways to write links.
Method 1
This is an example inline link.
NB: there is no space between [...]
and (...)
This is a link that has no title attribute.
Method 2
Here's a reference-style link to Google.
NB: There is a :
after the [...]
Method 3
Here's a very readable link to Yahoo!. The difference is in using a word instead of number for the link reference.
If the link reference is named the same, then you can do this:
This is a link to MSN
Different ways to write the "footnote" part
(The above three link definitions are equivalent:)
NB:
The link URL may, optionally, be surrounded by angle brackets:
NB:
The footnote part of a reference style link is always invisible.
The link itself is not rendered (i.e. visible with the square brackets) if the footnote does not exist.
If the footnote part is there, then the link becomes rendered and the second lot of [ ]
(i.e. the part that refers to the footnote) becomes invisible.
This is a [reference-style link] [visible].
Footnote
This is for real footnotes. i.e. the footnote actually is always visible and appear at the end of the document.
Here is some text containing a footnote 1 This is only available in multimarkdown
The footnote numbering is automatic.
⦿ NB:
- Main difference between a footnote and a reference styled link is that the text inside
[ ... ]
starts with a^
. - There is a
:
after the[...]
- The footnote text has to start at its own line
Comment
There is no specific allowance for commenting in markdown that is similar to the HTML <!-- comment -->
tag.
We can simply use the HTML tag, e.g. <!-- Comment -->
but it will appear in the generated HTML tag.
However, there is a workaround.
e.g. 1.
[comment]: <> (This is a comment that will not be included in the HTML generated. But some parsers will reject `<>` (e.g. GitHub))
e.g. 2.
[//]: <> (Also a comment)
e.g. 3 This is the best method.
[//]: # (This may be the most platform independent comment)
NB: To be safe, insert a blank line before and after comments, to keep these away from regular texts.
The comments will not be included the generated HTML at all unless a reference style link is used to refer to the comment.
Using comment on a link
This is the [link][comment].
This is the link.
With the link, the comment will be included in the generated HTML, but the [comment]
line would still be invisible.
Images
Images are exactly like links, but they have an exclamation point in front of them:
This is a image and it is NOT clickable.
A reference style image. Also not clickable.
Backslash escapes
Markdown provides backslash escapes for the following characters:
\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
HTML tags
From Daring FireballL
For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.
The only restrictions are that block-level HTML elements — e.g.
<div>
,<table>
,<pre>
,<p>
, etc. — must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces. Markdown is smart enough not to add extra (unwanted)<p>
tags around HTML block-level tags.For example, to add an HTML table to a Markdown article:
This is a regular paragraph.
AAA BBB CCC DDD This is another regular paragraph.
Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style emphasis inside an HTML block.
Span-level HTML tags — e.g.
<span>
,<cite>
, or<del>
— can be used anywhere in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you’d prefer to use HTML<a>
or<img>
tags instead of Markdown’s link or image syntax, go right ahead.Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.
Thus,
Strikethrough
Mou only implementation
~~Strikethrough~~ (Also works with GNU markdown)
Fenced code blocks are like Stardard Markdown’s regular code
blocks, except that they’re not indented and instead rely on
a start and end fence lines to delimit the code block.
Useful keyboard shortcuts
View
- Toggle live preview: Shift + Cmd + I ← Useful
- Toggle Words Counter: Shift + Cmd + W
- Toggle Transparent: Shift + Cmd + T
- Toggle Floating: Shift + Cmd + F ← Useful
- Left/Right = 1/1: Cmd + 0
- Left/Right = 3/1: Cmd + +
- Left/Right = 1/3: Cmd + -
- Toggle Writing orientation: Cmd + L
- Toggle fullscreen: Control + Cmd + F
Actions
- Copy HTML: Option + Cmd + C ← Useful
- Strong: Select text, Cmd + B
- Emphasize: Select text, Cmd + I
- Inline Code: Select text, Cmd + K
- Strikethrough: Select text, Cmd + U ← Useful
- Link: Select text, Control + Shift + L
- Image: Select text, Control + Shift + I
- Select Word: Control + Option + W
- Select Line: Shift + Cmd + L
- Select All: Cmd + A
- Deselect All: Cmd + D
- Convert to Uppercase: Select text, Control + U
- Convert to Lowercase: Select text, Control + Shift + U
- Convert to Titlecase: Select text, Control + Option + U
- Convert to List: Select lines, Control + L ← Useful
- Convert to Blockquote: Select lines, Control + Q ← Useful
- Convert to H1: Cmd + 1
- Convert to H2: Cmd + 2
- Convert to H3: Cmd + 3
- Convert to H4: Cmd + 4
- Convert to H5: Cmd + 5
- Convert to H6: Cmd + 6
- Convert Spaces to Tabs: Control + [
- Convert Tabs to Spaces: Control + ]
- Insert Current Date: Control + Shift + 1
- Insert Current Time: Control + Shift + 2
- Insert entity <: Control + Shift + ,
- Insert entity >: Control + Shift + .
- Insert entity &: Control + Shift + 7
- Insert entity Space: Control + Shift + Space
- Insert Scriptogr.am Header: Control + Shift + G
- Shift Line Left: Select lines, Cmd + [ ← Useful
- Shift Line Right: Select lines, Cmd + ] ← Useful
- New Line: Cmd + Return
- Comment: Cmd + / ← Useful
- Hard Linebreak: Control + Return ← Useful
-
Here is the text of the footnote itself. ↩