Markdown is a lightweight markup language, the original purpose of markdown is to provide a handy tool for text to html, with easy read and easy write syntax format. Markdown can be defined to: 1. plain-text syntax; 2. a software converting the plain-text to html.
When I was using wordpress as my personal blog, I didn’t know which text editor should I use for blogging. After I changed my blog frame to octopress, I begin to use markdown. With handy and simple syntax, it save my a lot of time. Because of its efficiency, I write all of my plain-text documents with markdown.
1. Markdown Syntax
Normally, markdown line breaks are identical like other editors' line break–Enter. But in some situation, There may be different, either by two Enters, or by three spaces in the end of line.
1 2 3 4 5 6 7 8 9 10
In WEB, it will be shown as:
This is H1
This is H2
This is H3
This is H4
This is H5
This is H6
1 2 3 4 5 6
William Wallace said:
What would you do without freedom,
would you fight?
This is first level
this is nested blockquotes
Blockquotes also can combine other syntax, such as Header, Lists etc.
1 2 3 4 5 6 7 8 9
This is a Header
- List item one
- List item two
Here’s some code block example:
#!/bin/bash echo "Hello World" exit 0
1.3.1 Unordered lists
Unordered list use hyphens or asterisks or pluses
1 2 3 4
- Unordered list item 1
- Unordered list item 2
- Unorder nested list item 2.1
- Unordered list item 3
1.3.2 Ordered lists
Ordered lists use numbers followed by periods:
1 2 3
- Ordered list item 1
- Ordered list item 2
- Ordered list item 3
1.4 Code Blocks and Syntax Highlighting
Indented with four spaces will fenced code block
Indented with four spaces #!/bin/bash echo "hello world"
#!/bin/bash echo "hello world"
Sometimes, back ticks are more efficiency. Besides, only back-ticks are supporting syntax highlighting, it’s recommended to use back ticks. Below examples actually no bakslash here, just for escaping.
Inline code block
Inline code highlighting.
1.5 Horizontal rules
1 2 3 4 5 6 7 8 9 10 11 12 13
With three or more asterisks, hyphens, or underscores:
Three or more asterisks
Markdown supports two style of line: inline or reference.
1 2 3 4 5 6 7 8 9
This is an inline Link for my blog.
This is an reference Link for my current post.
Also reference Link can be used like this way.
Images quote just like Link usages: inline or reference.
1 2 3
This is my image with inline .
This is my image with reference .
The way emphasize a word is using asterisks or underscores around the word.
1 2 3 4 5 6 7
Emphasis with one asterisk
With two underscores
Or with three asterisks
tildes add strikethrough to the word
1.9 Backslash Escapes
Markdown provides backslash escapes for the following characters:
1 2 3 4 5 6 7 8 9 10 11 12
Tables in markdown use pipes and hyphens(Three or more) with colon to align columns, the outer pipes can be optional.
1 2 3 4 5
|First name(Default Left align)||Last name(Centre align)||Salary(Right align)|
2. Markdown extension on google chrome
Google Chrome extension Markdown Preview Plus is for previewing markdown plain-text file via chrome browser, it also can convert the markdown plain-text file to mhtml file or PDF file.
Configuration for markdown preview
This extension supports customizing css style, I choose this one zhangjikai/markdown-css.
When using export tool by default, the html file is mhtml file format, in my laptop environment, I can’t open it with firefox browser, so I use this tool mht2htmcl (or you can download from my blog) to convert mht file to html file, after converting, it works perfectly for me.