Markdown

学习笔记

Posted by lidashuai on 2016-11-07

Markdown

Overview 概览

Outline

[TOC]

Headers 标题

使用1-6个 # 字符,分别代表了h1-h6六个标题等级

# This is an h1
## This is an h2
###### This is an h6

Blockquotes 块引用

Markdown使用 > 符号代表块引用,格式及效果如下:

> This is a blockquote with two paragraphs. This is first paragraph.
>
> This is second pragraph.



> This is another blockquote with one paragraph.There is three empty line to seperate two blockquote.

This is a blockquote with two paragraphs. This is first paragraph.

This is second pragraph.

This is another blockquote with one paragraph.There is three empty line to seperate two blockquote.

Lists 列表

输入* list item 1可以创建一个无序列表,除了 * 号,你也可以使用 + 或者 -

输入 1. list item 1 将会创建一个有序列表

### un-ordered list
* Red
* Green
* Blue

### ordered list
1. Red
2. Green
3. Blue

un-ordered list 无序列表

  • Red
  • Green
  • Blue

ordered list 有序列表

  1. Red
  2. Green
  3. Blue

Task List 任务列表

任务列表使用 -[ ] 或者-[x] (x代表默认选中,完成)标记

-[ ] incomplete
-[x] comleted

-[ ] incomplete

-[x] completed

Code Blocks 代码块

将代码包围在`


```gfm
Here's an example


funciton test(){
console.log(“notice the blank line before this function?”);
}


syntax highlighting
​```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html


Here's an example

funciton test(){
console.log(“notice the blank line before this function?”);
}


syntax highlighting
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

Math Blocks 数学式

你能够使用 MathJax 渲染 LaTeX 数学表达式

输入$$,然后输入区域就可以接受 Tex/LaTex

$$
\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0\
\end{vmatrix}
$$
markdown源文件如下

$$
\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\
\end{vmatrix}
$$

Tables 列表

输入|First Header|Second Header|可以创建一个两列的列表

|First Header|Second Header|
|------------|-------------|
|Content Cell|COntent Cell |
|Content Cell|Content Cell |
First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

你也可以使用列对齐,你可以通过:来实现左对齐、右对齐和居中对齐

| Left-Aligned  | Center Aligned  | Right Aligned |
| :------------ |:---------------:| -----:|
| col 3 is | some wordy text | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
Left-Aligned Center Aligned Right Aligned
col 3 is some wordy text $1600
col 2 is centered $12
zebra stripes are neat $1

Footnotes 脚注

你可以使用[^footnote]创建脚注,当鼠标经过时,可以看到脚注内容

You can create footnote like this[^footnote].
[^footnote]: Here is the *text* of the **footnote**.

You can create footnote like this[^footnote].

[^footnote]: Here is the text of the footnote.

Horizontal Rules 分割线

可以在空白行里使用 *** 或者 --- 创建一个水平分割线


Table of Contents 目录

输入[toc]就可以创建一个目录,它会自动提取文章里的标题,实时更新。

Span 元素

Markdown 支持两种形式的链接,行内链接和参考链接

它们形式相同,都是通过[square brackets方括号]创建。

行内链接是通过在方括号之后紧跟一个圆括号,圆括号内放入你想链接到的URL地址。

This is [an example](http://example.com/) inline link.

This is an example inline link.

你也可以设置锚点链接,通过锚点链接跳转到指定的标签上去,锚点可以在圆括号内设置,# 加上所要链接到的标题,下面的这个链接就是(#Headers 标题).

按住Command(on Windows: Ctrl)+ Click 点击链接,假如跳转到Headers 标题.

参考链接的形式类似于普通的链接,只不过方括号后面还是设置一个方括号而不是圆括号,后面的方括号里设置参考链接的id,像下面这样:

This is [an example][id] reference-style link.
Then,anywhere in the document, you define your link label like this, on a line by itself:

[id]: http://example.com/ "Optional Title Here"

This is an example reference-style link.
Then,anywhere in the document, you define your link label like this, on a line by itself:

你也可以设置隐式链接,直接省略id,在参考列表里直接填写链接名称

This is [an example][] reference-style link.
Then,anywhere in the document, you define your link label like this, on a line by itself:

[an example]: http://example.com/ "Optional Title Here"

This is an example reference-style link.
Then,anywhere in the document, you define your link label like this, on a line by itself:

Images 图片

图片类似于链接,但是需要在链接前面增加一个感叹号!

![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")

Alt text
Alt text

exa_img

Emphasis 强调

Markdown标记使用*_强调文本,类似于HTML中的<em>标签

*single asterisks*
_single underscores_

single asterisks
single underscores

在单词中,特别是代码名称中则会忽略_

wow_great_stuff
do_this_and_do_that_and_another_thing.

wow_great_stuff
do_this_and_do_that_and_another_thing.

当需要使用* _时,可以使用\进行转义

\*this text is surrounded by literal asterisks\*

*this text is surrounded by literal asterisks*

Strong 加粗

使用**__进行加粗,类似于HTML中的<strong>标签

**double asterisks**
__double underscores__

double asterisks
double underscores

Code 代码

使用(`)显示代码

Use the `printf()` function

Use the printf() function

Strikethrough 删除线(中划线)

使用~~可以创建删除线

~~Mistaken text.~~

Mistaken text.

Underline 下划线

markdown没有提供下划线命令,可以使用原生的HTML标签

<u>Underline</u> Underline

HTML

使用HTML原生的标签

  • Underline: <u>underline</u>
  • Image: <img src="http://www.w3.org/html/logo/img/mark-word-icon.png" width="200px" /> (And width, height attribute in HTML tag, and width, height, zoom style in style attribute will be applied.)
  • Comments: <!-- This is some comments -->
  • Hyperlink: <a href="http://typora.io" target="_blank">link</a>.