Markdown速查笔记

Markdown速查笔记

Markdown 是一种适合程序员做笔记的文本书写格式。按照官方文档解释:

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). Thus, “Markdown” is two things: (1) a plain text formatting syntax; and (2) a software tool, written in Perl, that converts the plain text formatting to HTML. See the Syntax page for details pertaining to Markdown’s formatting syntax. You can try it out, right now, using the online Dingus.

可见 Markdown 简单易懂,适合网络作家书写文档,同时具备优秀的工具,可以将 Markdown 转换为 html。

1. 标题设置(让字体变大,和 word 的标题意思一样)

在 Markdown 当中设置标题,有两种方式: 第一种:通过在文字下方添加“=”和“-”,他们分别表示一级标题和二级标题。 第二种:在文字开头加上 “#”,通过“#”数量表示几级标题。(一共只有 1~6 级标题,1 级标题字体最大)

1
2
3
# 一级标题

## 二级标题

一级标题

二级标题

2. 块注释(blockquote)

通过在文字开头添加“>”表示块注释。(当>和文字之间添加五个 blank 时,块注释的文字会有变化。)

1
> Do not be evil

Do not be evil

3. 斜体

将需要设置为斜体的文字两端使用 1 个“*”或者“_”夹起来:

1
*hello*

hello

4. 粗体

将需要设置为斜体的文字两端使用 2 个“*”或者“_”夹起来

1
**hello**

hello

5. 无序列表

在文字开头添加(*, +, -)实现无序列表。但是要注意在(*, +, and -)和文字之间需要添加空格。(建议:一个文档中只是用一种无序列表的表示方式)

1
2
3
4
5
* swift
* kotlin
* javascript
   * react
   * vue
  • swift
  • kotlin
  • javascript
    • react
    • vue

6. 有序列表

使用数字后面跟上句号。(还要有空格)

1
2
3
1. fist line
2. second line
3. third line
  1. fist line
  2. second line
  3. third line

Markdown 中有两种方式,实现链接,分别为内联方式和引用方式。 内联方式:

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

This is an example link.

引用方式:

1
2
3
4
5
I get 10 times more traffic from [Google][1] than from [Yahoo][2] or [MSN][3].

[1]: http://google.com/        "Google"
[2]: http://search.yahoo.com/  "Yahoo Search"
[3]: http://search.msn.com/    "MSN Search"

I get 10 times more traffic from Google than from Yahoo or MSN.

8. 图片(Images)

图片的处理方式和链接的处理方式,非常的类似。 内联方式:

1
![alt text](/asset/markdown-basic/example.jpeg "Title")

alt text

引用方式:

1
2
3
![alt text][id]

[id]: /assets/images/markdown-basic/example.jpeg "Title"

alt text

9. 代码(HTML 中所谓的 Code)

实现方式有两种: 第一种:简单文字出现一个代码框,。使用`print`。(`不是单引号而是左上角的 ESC 下面~中的`)

1
python中最常用的输出函数为`print`

python 中最常用的输出函数为print

第二种:大片文字需要实现代码框。使用```或 Tab 或四个空格。

1
2
3
4
5
6
注意前面有tab
    let func = async ()=>{
        console.log("begin");
        await delay(1);
        console.log("done");
    }
1
2
3
4
5
let func = async ()=>{
    console.log("begin");
    await delay(1);
    console.log("done");
}

10. 分割线

在空白行下方添加三条“-”横线。

11. 自然链接

用<>包裹url即可

1
<https://medium.com>

https://medium.com

Rating: