The manual of Markdown

251 阅读1分钟

微软官方文档

标题

# This is a H1 header
## This is a H2 header
### This is a H3 header
#### This is a H4 header
##### This is a H5 header

This is a H1 header

This is a H2 header

This is a H3 header

This is a H4 header

This is a H5 header

段落

Add two spaces prior to the end of the line.(space, space)【段落后两个空格】
This adds space in between paragraphs.

引用

> Single line quote
>> Nested    
>> multiple line
>> quote

Single line quote

Nested
multiple line
quote

分隔线

Add a horizontal rule by adding a new line that's just a series of dashes ---. There must be a blank line above the line containing the ---.

above
----
below

above

below

列表

  1. First item.【一个数字+.+空格】
  2. Second item.
  3. Third item.
  • Item 1
  • Item 2
  • Item 3
  1. First item.
    • Item 1【二级则每个前面三个空格
    • Item 2
    • Item 3
  2. Second item.
    • Nested item 1
    • Nested item 2
    • Nested item 3

链接

[Link Text](Link URL)
  • 相对路径: [text to display](./target.md)
  • 连接Gi绝对路径: [text to display](/folder/target.md)
  • 连接TFVC绝对路径: [text to display]($/project/folder/target.md)
  • URL: [text to display](http://address.com)
  • 连接其他Wiki文档绝对路径: [text to display](/parent-page/child-page)
  • 连接其他Wiki文档中的标题:[text to display](./target.md#heading-id) [text to display](/page-name#section-name)

唐诗宋词

文档内链接到标题

图片

![Text](URL)
  • Relative path: ![Image alt text](./image.png)
  • Absolute path in Git: ![Image alt text](/_img/markdown-guidance/image.png)
  • Absolute path in TFVC: ![Image alt text]($/project/folder/_img/markdown-guidance/image.png)
  • Resize image: ![Image alt text]($/project/folder/_img/markdown-guidance/image.png =WIDTHxHEIGHT)

唐诗宋词

表格

| Heading 1 | Heading 2 | Heading 3                       |
| --------- | :-------: | ------------------------------: |
| Cell A1   | Cell A2   | Cell A3                         |
| Cell B1   | Cell B2   | Cell B3<br/>second line of text |

Organize structured data with tables. Tables are especially useful for describing function parameters, object methods, and other data that has a clear name to description mapping. You can format tables in pull requests, wiki, and markdown files such as READMe files and markdown widgets.

  • Place each table row on its own line
  • Separate table cells using the pipe character |
  • The first two lines of a table set the column headers and the alignment of elements in the table
  • Use colons (:) when dividing the header and body of tables to specify column alignment (left, center, right)
  • To start a new line, use the HTML break tag (
    ) (Works within a Wiki but not elsewhere)
  • Make sure to end each row with a CR or LF.
Heading 1Heading 2Heading 3
Cell A1Cell A2Cell A3
Cell B1Cell B2Cell B3
second line of text

任务

- [ ] A  
- [ ] B  
- [ ] C  
- [x] A  
- [x] B  
- [x] C  
  • A
  • B
  • C
  • A
  • B
  • C

加粗、倾斜、删除线

Use _emphasis_ in comments to express **strong** opinions and point out ~~corrections~~ 
**_Bold, italizied text_**  
**~~Bold, strike-through text~~**
  • To apply italics: surround the text with an asterisk * or underscore _
  • To apply bold: surround the text with double asterisks **.
  • To apply strikethrough: surround the text with double tilde characters ~~

Use emphasis in comments to express strong opinions and point out corrections Bold, italizied text
Bold, strike-through text

代码高亮

``` language
code
```

Highlight suggested code segments using code highlight blocks. To indicate a span of code, wrap it with three backtick quotes (```) on a new line at both the start and end of the block. To indicate code inline, wrap it with one backtick quote (`).

supported languages Example: $ sudo npm install vsoagent-installer -g Result:

$ sudo npm install vsoagent-installer -g  

Example:

To install the Microsoft VSTS Cross Platform Build & Release Agent, run the following: `$ sudo npm install vsoagent-installer -g`.

Result: To install the Microsoft VSTS Cross Platform Build & Release Agent, run the following: $ sudo npm install vsoagent-installer -g.

``` js
const count = records.length;
```
const count = records.length;
``` csharp
Console.WriteLine("Hello, World!");
```
Console.WriteLine("Hello, World!");

Emoji

In pull request comments and wiki pages, you can use emojis to add character and react to comments in the request. Type in what you're feeling surrounded by : characters to get a matching emoji in your text. The full set of emojis are supported.

:smile:
:angry:

:smile: :angry:

换行

使用<br/>标签。

比如:
今天是周一。<br/>今天天气真好。
结果:
今天是周一。
今天天气真好。

  <br/>是html标签。由此可见,其实在Markdown中是可以使用html标签的,对于熟悉前端的小伙伴,完全可以用html+css实现一篇markdown文档。

数学公式

数学公式(行内嵌)

内嵌数学公式$\sum_{i=1}^{10}f(i)\,\,\text{thanks}$

效果:
内嵌数学公式i=110f(i)thanks\sum_{i=1}^{10}f(i)\,\,\text{thanks}

数学公式(块状)

$$
\sum_{i=1}^{10}f(i)\,\,\text{thanks}
$$
i=110f(i)thanks\sum_{i=1}^{10}f(i)\,\,\text{thanks}