Typora-Mac

MarkDown-Typora-Mac

[TOC]


1. 概述

1.1. 宗旨

Markdown的目标是实现「易读易写」。

Markdown语法受到一些既有text-to-HTML格式的影响,包括SetextatxTextilereStructuredTextGrutatextEtText,而最大灵感来源其实是纯文本电子邮件的格式。

1.2. 兼容 HTML

不在Markdown涵盖范围之内的标签,都可以直接在文档里面用HTML撰写。不需要额外标注这是HTML或是Markdown;只要直接加标签就可以了。

这是一个普通段落。
<table>
    <tr>
        <td>Foo</td>
    </tr>
</table>
这是另一个普通段落。

请注意,在HTML区块标签间的Markdown格式语法将不会被处理。比如,你在HTML区块内使用Markdown样式的强调会没有效果。

1.3. 特殊字符自动转换

HTML文件中,有两个字符需要特殊处理:<&<符号用于起始标签,&符号则用于标记HTML实体,如果你只是想要显示这些字符的原型,你必须要使用实体的形式,像是<&

&字符尤其让网络文档编写者受折磨,如果你要打「AT&T」 ,你必须要写成「AT&T」。而网址中的&字符也要转换。比如你要链接到:

http://images.google.com/images?num=30&q=larry+bird

你必须要把网址转换写为

http://images.google.com/images?num=30&q=larry+bird

才能放到链接标签的href属性里。不用说也知道这很容易忽略,这也可能是HTML标准检验所检查到的错误中,数量最多的。

类似的状况也会发生在<符号上,因为Markdown允许兼容 HTML,如果你是把<符号作为HTML标签的定界符使用,那Markdown也不会对它做任何转换,但是如果你写:

4 < 5

Markdown 将会把它转换为:

4 < 5

不过需要注意的是,code范围内,不论是行内还是区块,<&两个符号都一定会被转换成HTML实体,这项特性让你可以很容易地用MarkdownHTML code(和HTML相对而言,HTML语法中,你要把所有的<&都转换为HTML实体,才能在HTML文件里面写出HTML code。)


2. Key

  • Select word: cmd+D
  • Delete word: shift+cmd+D
  • Select line/sentence: cmd+L
  • Delete line/sentence: shift+cmd+L
  • Select row in table: cmd+L
  • Add row in table: cmd+Enter
  • Select Styled Scope (or cell in a table) cmd+E
  • Jump to selection: cmd+J
  • Jump to Top: cmd+
  • Jump To Bottom: cmd+↓
  • Increase/decrease heading level from <p> to <h1>: cmd+-/+
  • New line: shift+Return
  • Move table row/column: ⌘ + ⌃ + arrow key.

3. 区块元素

3.1. 内容目录

在段落中填写 [TOC] 以显示全文内容的目录结构。

3.2. 段落和换行

Return

Shift + Return

3.3. 标题

Header 1
========

Header 2
--------

or

# Header 1
## Header 2
###### Header 6

3.4. 区块引用

Angle brackets > are used for block quotes.
Technically not every line needs to start with a > as long as
there are no empty lines between paragraphs.
Looks kinda ugly though.

Block quotes can be nested.

Multiple Levels

Most markdown syntaxes work inside block quotes.

Here is the code:

> Angle brackets `>` are used for block quotes.  
Technically not every line needs to start with a `>` as long as
there are no empty lines between paragraphs.  
> Looks kinda ugly though.
> > Block quotes can be nested.  
> > > Multiple Levels
>
> Most markdown syntaxes work inside block quotes.
>
> * Lists
> * [Links][arbitrary_id]
> * Etc.

3.5. 列表

  • Lists must be preceded by a blank line (or block element)
  • Unordered lists start each item with a *
  • - works too
  • Indent a level to make a nested list
    1. Ordered lists are supported.
    2. Start each item (number-period-space) like 1.
    3. It doesn't matter what number you use, I will render them sequentially
    4. So you might want to start each line with 1. and let me sort it out

Here is the code:

* Lists must be preceded by a blank line (or block element)
* Unordered lists start each item with a `*`
- `-` works too
    * Indent a level to make a nested list
        1. Ordered lists are supported.
        2. Start each item (number-period-space) like `1. `
        42. It doesn't matter what number you use, I will render them sequentially
        1. So you might want to start each line with `1.` and let me sort it out
  1. [x] I can render checkbox list syntax
  • [x] I support nesting
  • [x] I support ordered and unordered lists
  1. [ ] I don't support clicking checkboxes directly in the html window

3.6. 代码区块

Inline code is indicated by surrounding it with backticks:
`Inline code`
``Code with `backticks` `` (mind the spaces preceding the final set of backticks)
多段代码换行+三个`

print('a')

多段代码换行+三个~

var s = "JavaScript syntax highlighting";
alert(s);
s = "Python syntax highlighting"
print s

换行+tab

print('This is a code block')

3.7. 分隔线

*** or ---


4. 区段元素

4.1. 链接

uranusjr@gmail.com
<uranusjr@gmail.com>
http://macdown.uranusjr.com
<http://macdown.uranusjr.com>
Macdown Website
[Macdown Website](http://macdown.uranusjr.com "Title") (The title is optional)

4.2. 引用

Make a link [a link][arbitrary_id] then on it's own line anywhere else in the file:
[arbitrary_id]: http://macdown.uranusjr.com "Title"

If the link text itself would make a good id, you can link like this [like this][], then on it's own line anywhere else in the file:
[like this]: http://macdown.uranusjr.com

4.3. 强调

Strong: **Strong** or __Strong__ (Command-B)
Emphasize: *Emphasize* or _Emphasize_[1] (Command-I)

4.4. 图片

![](path/or/url/to.jpg "Optional Title")
![Alt Image Text][image-id]
on it's own line elsewhere:
[image-id]: path/or/url/to.jpg "Optional Title"

4.5. 表格

First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

You can align cell contents with syntax like this:

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

The left- and right-most pipes (|) are only aesthetic, and can be omitted. The spaces don’t matter, either. Alignment depends solely on : marks.

4.6. 脚注

Text prior to footnote reference.[^2]
[^2] Comment to include in footnote.

H~2~O, X~long\ text~

H2O

Xlong text

5. 高级

5.1. 数学

$ 表示行内公式:

质能守恒方程可以用一个很简洁的方程式 $E=mc^2$ 来表达。

$$ 表示整行公式:

$$E=mc^2$$

访问 MathJax 参考更多使用方法。

5.2. 序列图

主流支持seq,typora支持sequence

Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!

更多语法参考:序列图语法

5.3. 流程图

st=>start: Start
op=>operation: Your Operation
cond=>condition: Yes or No?
e=>end

st->op->cond
cond(yes)->e
cond(no)->op

更多语法参考:流程图语法

5.4. Mermaid

Sequence

%% Example of sequence diagram
  sequenceDiagram

    Alice->>Bob: Hello Bob, how are you?
    alt is sick
    Bob->>Alice: Not so good :(
    else is well
    Bob->>Alice: Feeling fresh like a daisy
    end
    opt Extra response
    Bob->>Alice: Thanks for asking
    end

更多语法参考:Mermaid-Sequence

Flowchart

graph LR
A[Hard edge] -->B(Round edge)
    B --> C{Decision}
    C -->|One| D[Result one]
    C -->|Two| E[Result two]

更多语法参考:Mermaid-Flowchart

Gantt

%% Example with slection of syntaxes
        gantt
        dateFormat  YYYY-MM-DD
        title Adding GANTT diagram functionality to mermaid
    
        section A section
        Completed task            :done,    des1, 2014-01-06,2014-01-08
        Active task               :active,  des2, 2014-01-09, 3d
        Future task               :         des3, after des2, 5d
        Future task2               :         des4, after des3, 5d
    
        section Critical tasks
        Completed task in the critical line :crit, done, 2014-01-06,24h
        Implement parser and jison          :crit, done, after des1, 2d
        Create tests for parser             :crit, active, 3d
        Future task in critical line        :crit, 5d
        Create tests for renderer           :2d
        Add to mermaid                      :1d
    
        section Documentation
        Describe gantt syntax               :active, a1, after des1, 3d
        Add gantt diagram to demo page      :after a1  , 20h
        Add another diagram to demo page    :doc1, after a1  , 48h
    
        section Last section
        Describe gantt syntax               :after doc1, 3d
        Add gantt diagram to demo page      : 20h
        Add another diagram to demo page    : 48h

更多语法参考:Mermaid-Gantt

6 其它

6.1. 语法表格列表

The following is a list of optional inline markups supported:

Option name Markup Result if enabled
Intra-word emphasis So A*maz*ing So A maz ing
Strikethrough ~~Much wow~~ Much wow
Underline [2] _So doge_ <u>So doge</u>
Quote [3] "Such editor" "Such editor“
Highlight ==So good== ==So good==
Superscript hoge^(fuga) hogefuga
Autolink http://t.co http://t.co
Footnotes [^4] and [^4]: and footnote[^4]

4You don't have to use a number. Arbitrary things like [^footy note4] and [^footy note4]: will also work. But they will render as numbered footnotes. Also, no need to keep your footnotes in order, I will sort out the order for you so they appear in the same order they were referenced in the text body. You can even keep some footnotes near where you referenced them, and collect others at the bottom of the file in the traditional place for footnotes.

Markdown支持以下这些符号前面加上反斜杠来帮助插入普通的符号:

\   反斜线
`   反引号
*   星号
_   底线
{}  花括号
[]  方括号
()  括弧
#   井字号
+   加号
-   减号
.   英文句点
!   惊叹号

6.2. Jekyll front-matter

---
title: "Macdown is my friend"
date: 2014-06-06 20:00:00
---

6.3. 特殊符号 HTML Entities Codes

© & ¨ ™ ¡ £
& < > ¥ € ® ± ¶ § ¦ ¯ « ·

X² Y³ ¾ ¼ × ÷ »

18ºC " '

6.4. Emoji表情 :smiley:

Blockquotes :star:

GFM task lists & Emoji & fontAwesome icon emoji & editormd logo emoji :editormd-logo-5x:

  • [x] :smiley: @mentions, :smiley: #refs, links, formatting, and <del>tags</del> supported :editormd-logo:;
  • [x] list syntax required (any unordered or ordered list supported) :editormd-logo-3x:;
  • [x] [ ] :smiley: this is a complete item :smiley:;
  • [ ] []this is an incomplete item test link :fa-star: @pandao;
  • [ ] [ ]this is an incomplete item :fa-star: :fa-gear:;
    • [ ] :smiley: this is an incomplete item test link :fa-star: :fa-gear:;
    • [ ] :smiley: this is :fa-star: :fa-gear: an incomplete item test link;

  1. If Underlines is turned on, _this notation_ will render as underlined instead of emphasized

  2. If Underline is disabled _this_ will be rendered as emphasized instead of being underlined.

  3. Quote replaces literal " characters with html <q> tags. Quote and Smartypants are syntactically incompatible. If both are enabled, Quote takes precedence. Note that Quote is different from blockquote, which is part of standard Markdown.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 218,036评论 6 506
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,046评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,411评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,622评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,661评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,521评论 1 304
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,288评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,200评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,644评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,837评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,953评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,673评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,281评论 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,889评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,011评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,119评论 3 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,901评论 2 355

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,471评论 5 6
  • 1一个少妇去应征工作,随手将走廊上的纸片捡起来,放进了垃圾桶,被路过的考官看到了,他因此得到了这份工作。 原来获得...
    吴颖华阅读 324评论 0 0
  • 绿野镶白玉, 蓝天逐流云; 扬鞭须趁早, 放马任驰骋。 牧歌和藏酒, 彩旗弄晚风; 篝火红似火, 夜色最撩人。
    等等老少年阅读 106评论 0 6
  • 今天在订阅号看到一段文字: “生命就应该浪费在美好的事物上。” 然后,我只能说, 文字这东西实在厉害, 她一下子又...
    微笑5阅读 191评论 0 0
  • 近来老肖一直在和我分享他遇到的优秀的人,听到他一直在赞扬一个同龄人同事,五味陈杂,认真反思自己。 我多么庆幸我是在...
    午夜的月光阅读 120评论 0 0