Typora中的Markdown

Typora中的Markdown

概述

Markdown Daring Fireball創建的。最初的指導手冊. 但是,它的語法在不同的解析器或編輯器之間是不同的 Typora 用的是 GitHub風格的markdown.

請注意,markdown源代碼中的HTML片段將被識別,但不會被解析或呈現。此外,在保存后,原始的markdown源代碼可能會有小的重新格式化。

塊級元素

段落和換行符

段落只是一個或多個連續的文本行。在markdown源代碼中,段落被多個空行分隔。在Typora中,你只需要按“Return”來創建一個新段落。

Shift + Return 來創建一個換行符。 但是,大多數markdown解析器將忽略單行換行符, 為了讓其他編輯器能識別您的換行符,你最好在行末添加2個空格,或者插入<br/>

標題

有以下1-6級標題例如:

# This is an H1

## This is an H2

###### This is an H6

在Typora中,輸入‘#’再加上你的內容,然后回車就創建了一個標題

引用

Markdown使用電子郵件樣式的>字符進行塊引用。例子:

> This is a blockquote with two paragraphs. This is first paragraph.
>
> This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.



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

在typora中,只需輸入' > ',后面跟著引號內容,就會生成塊引號。Typora會為你插入合適的>或換行符。通過添加額外的“>”級別,可以在另一個語句塊中引用塊引號。

列表

輸入 * 列表項1 將創建無序列表, * 也可以替換成 + or -.

輸入1. 列表項 1 將創建一個有序列表,markdown代碼如下:

## 無序列表
*   紅
*   綠
*   藍

## 有序列表
1.  紅
2.  綠
3.  藍

任務列表

任務列表是帶有標記為[]或x項的列表。例如:

- [ ] 一條任務列表項
- [ ] 任務列表的語法要求
- [ ] normal **formatting**, @mentions, #1234 refs
- [ ] incomplete
- [x] completed

你可以點擊元素前面的復選框來更改完成和未完成狀態。

保護的代碼塊

Typora只支持Github風格的Markdown。不支持markdown中的原始代碼塊。

使用保護代碼塊很簡單: 輸入 ``` 并且按 回車. 在```之后添加一個可選的語言標識符,我們將通過語法高亮顯示運行它:

舉個栗子

```
function test() {
  console.log("notice the blank line before this function?");
}
```

ruby語法高亮:
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```

數學塊

你可以使用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源文件中,math塊是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}
$$

表格

輸入 | 標題1 | 標題2 | 再按 回車 將創建一個兩列的表格.

創建表之后,將焦點放在該表上,將彈出一個表的工具欄,您可以在其中調整、對齊或刪除表。您還可以使用上下文菜單來復制和添加/刪除列/行。

可以跳過以下描述,因為typora自動生成表的markdown源代碼。
在markdown代碼中要這么生成表格:

| 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 |

冒號左邊的一側表示左對齊列;最右邊一側冒號表示右對齊列;雙方一個冒號表示居中對齊列。
而使用Typora不用這么麻煩些表格,當你在Typora創建表格之后,會自動出現工具幫助你實現以上的功能,最大限度的聚焦在你的思路上。

注腳

您可以創建這樣的腳注[^footnote].

[^footnote]: 寫點啥呢? *寫點斜體的* 或者 **粗體的**.

這樣就能創建這樣的東西:
腳注

鼠標放在在“腳注”上能看到腳注的內容。

分割線

在空白行輸入 *** 或者 --- 再按 回車 將畫一條分割線。


YAML Front Matter

Typora support YAML Front Matter now. Input --- at the top of the article and then press Enter will introduce one. Or insert one metadata block from the menu.

目錄 (TOC)

輸入 [toc]再按 回車 會創建一個目錄的段落,這個目錄會提取作者的所有標題,它的內容會自動更新。樣子是這樣的:

大綱.jpg

圖(序列圖、流程圖、人魚圖)

Typora 支持, 徐磊圖, 流程圖 and 人魚圖,在系統偏好設置中能啟用這些特性。

欲知詳情請看 圖表文檔

Span 元素

在您輸入之后,Span元素將被解析并呈現。將光標移動到這些span元素的中間將把這些元素擴展為markdown源代碼。下面將解釋這些span元素的語法。

鏈接

Markdown支持兩種風格的鏈接:內聯和參考。

這2種風格,鏈接文本用[]包裹。

要創建內聯鏈接,請在鏈接文本的結束方括號之后立即使用一組常規圓括號。在括號內,將URL放置在您希望鏈接指向的地方,以及鏈接的可選標題,并在引號中包圍。例如:

這里是 [百度](http://baidu.com/ "百度的首頁") .

[沒有注釋的鏈接](http://baidu.com/) 沒有title的注釋.

will produce:

這里是 百度 .

沒有注釋的鏈接 沒有title的注釋

內部鏈接

You can set the href to headers, which will create a bookmark that allow you to jump to that section after clicking. For example:

Command(on Windows: Ctrl) + Click This link will jump to header Block Elements. To see how to write that, please move cursor or click that link with ? key pressed to expand the element into markdown source.

Reference Links

Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:

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"

In typora, they will be rendered like:

This is an example reference-style link.

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/

In typora click link will expand it for editing, command+click will open the hyperlink in web browser.

URLs

Typora allows you to insert urls as links, wrapped by <brackets>.

<i@typora.io> becomes i@typora.io.

Typora will aslo auto link standard URLs. e.g: www.google.com.

Images

Image looks similar with links, but it requires an additional ! char before the start of link. Image syntax looks like this:

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

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

You are able to use drag & drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag & drop.

For more tips on images, please read http://support.typora.io//Images/

Emphasis

Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML <em> tag. E.g:

*single asterisks*

_single underscores_

output:

single asterisks

single underscores

GFM will ignores underscores in words, which is commonly used in code and names, like this:

wow_great_stuff

do_this_and_do_that_and_another_thing.

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:

\*this text is surrounded by literal asterisks\*

Typora recommends to use * symbol.

Strong

double *’s or _’s will be wrapped with an HTML <strong> tag, e.g:

**double asterisks**

__double underscores__

output:

double asterisks

double underscores

Typora recommends to use ** symbol.

Code

To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

Use the `printf()` function.

will produce:

Use the printf() function.

Strikethrough

GFM adds syntax to create strikethrough text, which is missing from standard Markdown.

~~Mistaken text.~~ becomes Mistaken text.

Underline

Underline is powered by raw HTML.

<u>Underline</u> becomes <u>Underline</u>.

Emoji :smile:

Input emoji with syntax :smile:.

User can trigger auto-complete suggestions for emoji by pressing ESC key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from Edit -> Emoji & Symbols from menu bar is also supported.

HTML

Typora cannot render html fragments. But typora can parse and render very limited HTML fragments, as an extension of Markdown, including:

  • 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: ``
  • Hyperlink: <a target="_blank">link</a>.

Most of their attributes, styles, or classes will be ignored. For other tags, typora will render them as raw HTML snippets.

But those HTML will be exported on print or export.

Inline Math

To use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use $ to wrap TeX command, for example: $\lim_{x \to \infty} \exp(-x) = 0$ will be rendered as LaTeX command.

To trigger inline preview for inline math: input “$”, then press ESC key, then input TeX command, a preview tooltip will be visible like below:

<img src="http://typora.io/img/inline-math.gif" style="zoom:50%;" />

Subscript

To use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use ~ to wrap subscript content, for example: H~2~O, X~long\ text~/

Superscript

To use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use ^ to wrap superscript content, for example: X^2^.

Highlight

To use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use == to wrap superscript content, for example: ==highlight==.

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 230,622評論 6 544
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 99,716評論 3 429
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 178,746評論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,991評論 1 318
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,706評論 6 413
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 56,036評論 1 329
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 44,029評論 3 450
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 43,203評論 0 290
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,725評論 1 336
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 41,451評論 3 361
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,677評論 1 374
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 39,161評論 5 365
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,857評論 3 351
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,266評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,606評論 1 295
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 52,407評論 3 400
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,643評論 2 380

推薦閱讀更多精彩內容