Markdown语法偏好设置官方文档译文(中英对照)

Markdown For Typora

译者:道法自然��
未经允许不得转载

Overview

概述

Markdown is created by Daring Fireball; the original guideline is here. Its syntax, however, varies between different parsers or editors. Typora is using GitHub Flavored Markdown.

Markdown是由Daring Fireball创建的;原始指南在这里。然而,它的语法在不同的解析器或编辑器之间是不同的。Typora是正在使用[GitHub风格的Markdown][GEM]。

Block Elements

##块元素

Paragraph and line breaks

###段落和换行

A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by two or more blank lines. In Typora, you only need one blank line (press Return once) to create a new paragraph.

一个段落只是一个或多个连续的文本行。在markdown源代码中,段落由两行或多行空行分隔。在Typora中,你只需要一个空行(按一次回车键)就可以创建一个新的段落。

Press Shift + Return to create a single line break. Most other markdown parsers will ignore single line breaks, so in order to make other markdown parsers recognize your line break, you can leave two spaces at the end of the line, or insert <br/>.

shift+Rrturn来创建一个单行断句。大多数其他的markdown分析器会忽略单行断句,所以为了让其它markdown分析器识别你的断行,你可以在行尾留两个空格,或者插入<br>

Headers

标题

Headers use 1-6 hash (#) characters at the start of the line, corresponding to header levels 1-6. For example:

标题在行首使用1-6个哈希(#)字符,对应于标题级别1-6,比如说。

# This is an H1
# 这是一个一级标题
## This is an H2
## 这是一个二级标题
###### This is an H6
###### 这是一个六级标题

In Typora, input ‘#’s followed by title content, and press Return key will create a header.

在Typora中,输入’#’,然后是标题内容,按Return键就可以创建一个标题。

Blockquotes

区块引用

Markdown uses email-style > characters for block quoting. They are presented as:

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.
>这是第二段,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.
> 这是另一个有一个段落的区块引用,有三个空行来隔开两个分块引号。

译者注:实际效果如下:

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.
这是第二段,Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

这是另一个有一个段落的区块引用,有三个空行来隔开两个分块引号。dfghjklhjklhghjkldfg烦烦烦烦烦烦烦烦烦

In Typora, inputting ‘>’ followed by your quote contents will generate a quote block. Typora will insert a proper ‘>’ or line break for you. Nested block quotes (a block quote inside another block quote) by adding additional levels of ‘>’.

在Typora中,输入’>’,然后再输入你的引用内容,将产生一个引用块。Typora将为您插入适当的’>'或换行符。通过添加额外的">"来实现嵌套式的块状引号(一个引用块在另一个引用块中)。

Lists

列表

Input * list item 1 will create an unordered list - the * symbol can be replace with + or -.

输入* list item 1将创建一个无序的列表 - *符号可以用+-来代替。

Input 1. list item 1 will create an ordered list - their markdown source code is as follows:

输入 1. list item 1 将创建一个有序的列表 - 它们的 markdown 源代码如下

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

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

译者注:实际效果如下:

un-ordered list

  • Red

ordered list

  1. Red

Task List

任务列表

Task lists are lists with items marked as either [ ] or [x] (incomplete or complete). For example:

任务清单是带有标记为[ ]或[x](未完成或已完成)的项目的清单。比如说:

- [ ] a task list item
- [ ] list syntax required
- [ ] normal **formatting**, @mentions, #1234 refs
- [ ] incomplete
- [x] completed

译者注:实际效果如下:

  • incomplete
  • completed

You can change the complete/incomplete state by clicking on the checkbox before the item.

你可以通过点击项目前的复选框来改变完整/不完整状态。

(Fenced) Code Blocks

###(用边框隔开的)代码块

Typora only supports fences in GitHub Flavored Markdown. Original code blocks in markdown are not supported.

Typora只支持GitHub Flavored Markdown中的代码块。不支持markdown中的原始代码块。

Using fences is easy: Input ``` and press return. Add an optional language identifier after ``` and we’ll run it through syntax highlighting:

使用代码块很简单:输入```然后按回车键。在```后面添加一个可选的语言标识符,我们将通过语法高亮运行它。

Here's an example:

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

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

译者注:实际效果如下:

```C(语言名称然后回车)

#include<stdio.h>

Math Blocks

数学块(插入数学公式)

You can render LaTeX mathematical expressions using MathJax.

你可以使用MathJax渲染LaTeX(注:一种基于ΤΕΧ的排版系统,生成复杂表格和数学公式)的数学表达式。

To add a mathematical expression, input $$ and press the ‘Return’ key. This will trigger an input field which accepts Tex/LaTex source. For example:

要添加一个数学表达式,请输入$$并按”回车“键,这将触发一个接受Tex/LaTex来源的输入域。比如:

V 1 × V 2 = ∣ i j k ∂ X ∂ u ∂ Y ∂ u 0 ∂ X ∂ v ∂ Y ∂ v 0 ∣ \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} V1×V2=iuXvXjuYvYk00

In the markdown source file, the math block is a LaTeX expression wrapped by a pair of ‘$$’ marks:

在markdown源文件中,数学块是一个由一对"$$"标记包裹的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}
$$

You can find more details here.

你可以在这里找到更多的详细信息。

Tables

Input | First Header | Second Header | and press the return key. This will create a table with two columns.

输入|第一个标题 | 第二个标题 |然后按回车键,这将创建一个有两列的表格。

译者注:

第一个标题第二个标题

After a table is created, putting focus on that table will open up a toolbar for the table where you can resize, align, or delete the table. You can also use the context menu to copy and add/delete individual columns/rows.

在创建了一个表格后,将鼠标放在该表格上会打开该表格的工具栏,在那里你可以调整大小、对齐或删除该表格。你还可以使用上下文菜单来复制和添加/删除个别列/行。

The full syntax for tables is described below, but it is not necessary to know the full syntax in detail as the markdown source code for tables is generated automatically by Typora.

下面介绍了表格的完整语法,但没有必要详细了解完整的语法,因为表格的markdown源代码是由Typora自动生成的。

In markdown source code, they look like:

在markdown源代码中,他们像这样:

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

You can also include inline Markdown such as links, bold, italics, or strikethrough in the table.

你也可以在表格中包括内联的Markdown,如链接、粗体、斜体或删除线。

Finally, by including colons (:) within the header row, you can define text in that column to be left-aligned, right-aligned, or center-aligned:

最后,通过在标题行内加入冒号(:),你可以将该列中的文本定义为左对齐、右对齐或居中对齐:

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

A colon on the left-most side indicates a left-aligned column; a colon on the right-most side indicates a right-aligned column; a colon on both sides indicates a center-aligned column.

最左边的冒号表示左对齐的列;最右边的冒号表示右对齐的列;两边的冒号表示中间对齐的列。

Footnotes

脚注

You can create footnotes like this[^footnote].

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

will produce:

将出现:

You can create footnotes like this1.

Hover over the ‘footnote’ superscript to see content of the footnote.

将鼠标悬停在 "脚注 "上标,可以看到脚注的内容。

Horizontal Rules

横线

Inputting *** or --- on a blank line and pressing return will draw a horizontal line.

在空行上输入***---,然后按回车键,将画出一条横线。



YAML Front Matter

前言

Typora now supports YAML Front Matter. Input --- at the top of the article and then press Return to introduce a metadata block. Alternatively, you can insert a metadata block from the top menu of Typora.

Typora现在支持YAML Front Matter。在文章的顶部输入---,然后按回车键来引入一个元数据块。另外,你也可以从Typora的顶部菜单中插入一个元数据块。

Table of Contents (TOC)

目录

Input [toc] and press the Return key. This will create a “Table of Contents” section. The TOC extracts all headers from the document, and its contents are updated automatically as you add to the document.

输入[toc]并按回车键,这将创建一个 "目录 "部分。TOC从文件中提取所有的标题,当你添加到文件中时,其内容会自动更新。

Span Elements

Span 元素

Span elements will be parsed and rendered right after typing. Moving the cursor in middle of those span elements will expand those elements into markdown source. Below is an explanation of the syntax for each span element.

Span元素将在输入后立即被解析和呈现。将光标移到这些Span元素的中间会将这些元素扩展成markdown源。下面是对每个Span元素的语法的解释。

Links

链接

Markdown supports two styles of links: inline and reference.

Markdown支持两种风格的链接:内联和引用。

In both styles, the link text is delimited by [square brackets].

在这两种风格中,链接文本都由[方括号]划定。

To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:

要创建一个内联链接,请在链接文本的结尾方括号后立即使用一组普通的小括号。在括号内,把你想让链接指向的URL,以及一个可选的链接标题,用引号包围。比如说。

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

[This link](http://example.net/) has no title attribute.

will produce:

将出现:

This is an example inline link. (<p>This is <a href="http://example.com/" title="Title">)

This link has no title attribute. (<p><a href="http://example.net/">This link</a> has no)

Internal Links
内链

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

你可以将href设置为标题,这将创建一个书签,让你在点击后跳到该部分。比如说:

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.

命令(在Windows上:Ctrl)+点击这个链接 将跳到标题块元素。要看如何写,请移动光标或按下⌘键点击该链接,将该元素扩展到markdown源。

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 on a line by itself like this:

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

In Typora, they will be rendered like so:

在Typora中,它们将被渲染成这样:

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 — for example, to link the word “Google” to the google.com web site, you could simply write:

隐含链接名称的快捷方式允许你省略链接的名称,在这种情况下,链接文本本身被用作名称。只需使用一组空的方括号–例如,要将 "Google "这个词链接到google.com网站,你可以简单地写。

[Google][]
And then define the link:

[Google]: http://google.com/

In Typora, clicking the link will expand it for editing, and command+click will open the hyperlink in your web browser.

在Typora中,点击链接将展开它进行编辑,而命令+点击将在你的网络浏览器中打开该超链接。

URLs

网络地址(统一资源定位器)

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

Typora允许你把URL作为链接插入,用<brackets>封装。

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

Typora will also automatically link standard URLs. e.g: www.google.com.

Typora 也会自动链接标准的URL。例如:www.google.com。

Images

图片

Images have similar syntax as links, but they require an additional ! char before the start of the link. The syntax for inserting an image 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 an image from an image file or your web browser. You can modify the markdown source code by clicking on the image. A relative path will be used if the image that is added using drag & drop is in same directory or sub-directory as the document you’re currently editing.

你能够使用拖放的方式从图像文件或你的网络浏览器中插入一个图像。你可以通过点击图片来修改markdown源代码。如果用拖放方式添加的图像与你目前正在编辑的文件在同一目录或子目录下,则会使用相对路径。

If you’re using markdown for building websites, you may specify a URL prefix for the image preview on your local computer with property typora-root-url in YAML Front Matters. For example, input typora-root-url:/User/Abner/Website/typora.io/ in YAML Front Matters, and then ![alt](/blog/img/test.png) will be treated as ![alt](file:///User/Abner/Website/typora.io/blog/img/test.png) in Typora.

如果你使用markdown来建立网站,你可以在YAML Front Matters中用属性tybora-root-url为本地电脑上的图片预览指定一个URL前缀。例如,在YAML Front Matters中输入typora-root-url:/User/Abner/Website/typora.io/,然后,在Typora中 ![alt](/blog/img/test.png)将被视为![alt](file:///User/Abner/Website/typora.io/blog/img/test.png)

You can find more details here.

你能够在这里找到更多。

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:

Markdown把星号(*)和下划线(_)作为强调的标志。用一个*_包裹的文本将用一个HTML 标签来包裹。例如:

*single asterisks*

_single underscores_

output:

输出:

single asterisks

单个星号

single underscores

单个下划线

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

GFM会忽略单词中的下划线,这在代码和名称中是常用的,比如这样。

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 using the * symbol.

Typora建议使用*符号。

Strong

加粗

A double * or _ will cause its enclosed contents to be wrapped with an HTML <strong> tag, e.g:

两个 *_将导致其包含的内容被包裹在一个HTML<strong>标签中,例如:

**double asterisks**

__double underscores__

output:

double asterisks

double underscores

Typora recommends using the ** symbol.

Typora建议使用**符号

Code

代码

To indicate an inline 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.

GFM增加了创建删除线文本的语法,这在标准的Markdown中是没有的。

~~Mistaken text.~~ becomes Mistaken text.

Underlines

下划线

Underline is powered by raw HTML.

下划线是由原始HTMl驱动的。

<u>Underline</u> becomes Underline.

Emoji 😄

表情😄

Input emoji with syntax :smile:.

输入表情符号的语法😄。

User can trigger auto-complete suggestions for emoji by pressing ESC key, or trigger it automatically after enabling it on preference panel. Also, inputting UTF-8 emoji characters directly is also supported by going to Edit -> Emoji & Symbols in the menu bar (macOS).

用户可以通过按ESC键触发表情符号的自动完成建议,或者在偏好面板上启用后自动触发。此外,通过进入菜单栏(macOS)的 Edit -> Emoji & Symbols,也支持直接输入UTF-8表情符号。

Inline Math

内联公式

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

要使用这个功能请在,请先在偏好设置面板->Markdown标签中启用它,然后,用&来包裹TeX命令。例如:$\lim_{x \to \infty} \exp(-x) = 0$将被呈现为LaTeX命令。

To trigger inline preview for inline math: input “$”, then press the ESC key, then input a TeX command.

触发内联数学的内联预览:输入"$",然后按ESC键,再输入一条TeX命令。

You can find more details here.

你能够在这里找到更多的细节。

Subscript

下标

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

要使用这个功能请在,请先在偏好设置面板->Markdown标签中启用它,然后,使用~来包装下标内容。例如:H~2~O, X~long\ text~/

Superscript

上标

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

要使用这个功能请在,请先在偏好设置面板->Markdown标签中启用它,然后,使用^来包装下标内容。例如:X^2^

Highlight

高亮

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

要使用这个功能请在,请先在偏好设置面板->Markdown标签中启用它,然后,使用==来包装下标内容。例如:==highlight==

HTML

You can use HTML to style content what pure Markdown does not support. For example, use <span style="color:red">this text is red</span> to add text with red color.

你可以用HTML来为纯Markdown不支持的内容样式。例如,使用这个文本是红色的来添加红色的文本。

Embed Contents

嵌入内容

Some websites provide iframe-based embed code which you can also paste into Typora. For example:

有些网站提供基于iframe的嵌入代码,你也可以将其粘贴到Typora中。比如说。

<iframe height='265' scrolling='no' title='Fancy Animated SVG Menu' src='http://codepen.io/jeangontijo/embed/OxVywj/?height=265&theme-id=0&default-tab=css,result&embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'></iframe>

Video

视频

You can use the <video> HTML tag to embed videos. For example:

你可以使用<video>HTML标签来嵌入视频。比如说:

<video src="xxx.mp4" />

Other HTML Support

其它HTML支持

You can find more details here.

你能够在这里找到更多细节。

pora中。比如说。

<iframe height='265' scrolling='no' title='Fancy Animated SVG Menu' src='http://codepen.io/jeangontijo/embed/OxVywj/?height=265&theme-id=0&default-tab=css,result&embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'></iframe>

Video

视频

You can use the <video> HTML tag to embed videos. For example:

你可以使用<video>HTML标签来嵌入视频。比如说:

<video src="xxx.mp4" />

Other HTML Support

其它HTML支持

You can find more details here.

你能够在这里找到更多细节。


  1. Here is the text of the footnote. ↩︎

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值