关于markdown:M↓Markdown-使用手册

5次阅读

共计 4273 个字符,预计需要花费 11 分钟才能阅读完成。

Markdown (M↓) 之旅

Preface

Markdown 是一种轻量级的标记语言,容许人们应用易读易写的纯文本格式编写文档,是写博客、论文的绝佳工具。Markdown 能够被转为 html,pdf,word 格局文档。

1. 抉择
  1.1 VSCode + Extension
  1.2 Typora
2. Markdown 语法
  2.1 文本款式
    2.1.1 斜体·加粗·删除线
    2.1.2 强调
  2.2 题目
  2.3 分段
  2.4 援用
    2.4.1 单行援用
    2.4.2 多行援用
    2.4.3 嵌套援用
  2.5 列表 list
    2.5.1 无序列表
    2.5.2 有序列表
    2.5.3 嵌套列表
  2.6 链接
    2.6.1 间接链接
    2.6.2 链接名
    2.6.3 多个同名链接
  2.7 图片
  2.8 代码
    2.8.1 单行代码
    2.8.2 多行代码
  2.9 表格

1. 抉择

这里介绍两种应用形式

1. 1. VSCode + Extension

Visual Studio Code isn’t a dedicated Markdown editor, but has the functionality to be used as one all the same. VS Code provides Markdown editing capabilities out-of-the-box, but you can install an extension for even greater functionality, like shortcuts, creating a table of contents, and more.

(Visual Studio Code 不是专用的 Markdown 编辑器,但具备雷同的性能。VS Code 提供了开箱即用的 Markdown 编辑性能,但您能够装置扩大以取得更多功能,例如快捷方式、创立目录等)

我抉择的就是这个形式,因为右边是 M↓(Markdown)语法,左边能够预览,显示它的 preview。我认为对于老手而言,这种分页式更敌对,更利于相熟语法。

VSCode 是代码编辑器,无需多言,而其上的 extension 也有不少,我目前用的是 markdownlint 和 Markdown Preview Github Styling。当然也有 Markdown All In One 等优良的 extension 可供选择。

1. 2. Typora

Typora is one of the most popular Markdown editors, and for good reason. Unlike many of the editors you’ll find on this list, Typora automatically hides Markdown formatting, showing a preview of the final document instead.

It’s a robust editor with support for advanced Markdown features such as mathematics and diagrams, and a wide range of export options.

(Typora 是最受欢迎的 Markdown 编辑器之一,这是有充沛理由的。与您在此列表中找到的许多编辑器不同,Typora 会自动隐藏 Markdown 格局,而是显示最终文档的预览。
它是一个弱小的编辑器,反对高级 Markdown 性能,例如数学和图表,以及宽泛的导出选项 )

Typora 不反对分栏,预览,我认为更实用于使用纯熟的 Markdowner。

当然,还有 MacDown, Draft, Ulysses 等编辑器可供使用。大家能够自行抉择。

2. Markdown 语法

2.1. 文本款式

2. 1. 1. 斜体·加粗·删除线

*斜体 * or \_ 斜体_

* 加粗 *

*斜体加粗 or \___斜体加粗 __(3 个 )

\~~ 删除线~~

  • 注:* ~与文本之间不能有空格

2. 1. 2. 强调

* 123 + 123 - 123

* 或 + 或 – 加空格 能够产生以下成果:

  • 123

- * 123

连用 2 个 * 或 + 或 – 加空格 能够产生以下成果:

    • 123

`+ + + 123
`

连用 3 个 * 或 + 或 – 加空格 能够产生以下成果:

      • 123
  • 勾销强调

若想让 * 可见,加上 ‘ \ ‘ 即可:

\* 勾销强调 成果:* 勾销强调

2.2. 题目

一级题目

二级题目

三级题目

四级题目

五级题目
六级题目
  • 注:
    1.# 与题目间须要空格 \
    2. 最多有 6 级题目

2.3. 分段

I have eaten
the plums
that were in
the icebox

的成果是:
I have eaten
the plums
that were in
the icebox

I have eaten\
the plums\
that were in\
the icebox

的成果是:

I have eaten\
the plums\
that were in\
the icebox

2.4. 援用

2. 4. 1. 单行援用

The quote“Somewhere, something incredible is waiting to be known”has been ascribed to Carl Sagan.

退出援用 :

The quote 
>Somewhere, something incredible is waiting to be known

has been ascribed to Carl Sagan.

成果:

The quote

Somewhere, something incredible is waiting to be known

has been ascribed to Carl Sagan.

2. 4. 2. 多行援用

Allowing an unimportant mistake to pass without comment is a wonderful social grace.

Ideological differences are no excuse for rudeness.

被援用后:

> Allowing an unimportant mistake to pass without comment is a wonderful social grace.
>
> Ideological differences are no excuse for rudeness.

成果:

Allowing an unimportant mistake to pass without comment is a wonderful social grace.

Ideological differences are no excuse for rudeness.

2. 4. 3. 嵌套援用

套娃正告!

1

2

3

2.5. 列表 list

2. 5. 1 无序列表

- Flour
- Cheese
- Tomatoes

成果:

  • Flour
  • Cheese
  • Tomatoes

* – + 3 种符号都能够(应用同种符号才有 list 的成果,不同种符号行间距过大)

2. 5. 2 有序列表

Four steps to better sleep:
1. Stick to a sleep schedule
2. Create a bedtime ritual
6. Get comfortable
4. Manage stress

成果:

Four steps to better sleep:

  1. Stick to a sleep schedule
  2. Create a bedtime ritual
  3. Get comfortable
  4. Manage stress
  • 注:\
    1. 标号只有从 1 开始,前面轻易写,它会主动排序 \
    2. 序号与文本间须要空格

2. 5. 3 嵌套列表

上、上级之间须要 2 个空格

无序
* 一级
  * 二级 
  * 二级
    * 三级 

成果:

  • 一级

    • 二级
    • 二级

      • 三级
有序
1. 一级 12. 一级 2    1. 二级 1    2. 二级 2        1. 三级 13. 一级 3 

成果:

  1. 一级 1
  2. 一级 2

    1. 二级 1
    2. 二级 2

      1. 三级 1
  3. 一级 3

若想勾销标号,
12\. 勾销程序标号

1. 是关上或敞开 12\. 勾销程序标号

成果:

  1. 是关上或敞开
    12. 勾销程序标号
  • Markdown TOC 插件 能够主动生成目录和序号

2.6. 链接

2. 6. 1. 间接链接

You can search anything at <https://www.zhihu.com/>

You can search anything at https://www.zhihu.com/

  • 不加 <> 也能够,但左右须要空格

2. 6. 2. 链接名

[链接名](链接地址)

如:
[stackoverflow](https://stackoverflow.com)

成果:
stackoverflow

2. 6. 3. 多个同名链接

[飓风][1]Erika 是 1997 年大西洋 [飓风][1] 节令中最强和持续时间最长的寒带气旋。[1]:https://baike.baidu.com/item/%E9%A3%93%E9%A3%8E/17274?fr=aladdin

飓风 Erika 是 1997 年大西洋飓风节令中最强和持续时间最长的寒带气旋。

2.7. 图片

![alt](图片地址 "title")\
alt 是图片下方文字,title 是鼠标移到图片上显示的文字

如:

![](https://commonmark.org/help/images/favicon.png)

此链接为 [巴斯光年][2] 图片[2]:https://gss0.baidu.com/70cFfyinKgQFm2e88IuM_a/baike/pic/item/500fd9f9d72a60590804cff62034349b023bbac1.jpg "buzz lightyear"

此链接为 巴斯光年 图片

2.8. 代码

2. 8. 1. 单行代码

\` x = 2 \`
成果:x = 2

2. 8. 2. 多行代码

\“`\
x = y\
t = x\
y = t\
\“`

成果:

x = yt = xy = t

` 前面加上语言,markdown 会主动依据语言的格局高亮

\“`python\
for i in range(4):\

print(i)\

\“`

for i in range(4):    print(i)

Who ate the most donuts this week?    Jeff  15    Sam   11    Robin  6

成果:

Who ate the most donuts this week?

Jeff  15Sam   11Robin  6

注:不是单引号 ',而是反单引号(`) , 对于 多行代码 而言,~ ~ 也能够实现,但可能不是标准的语法

对于代码块中退出润饰文本的性能(如:加粗,斜体,加题目,扭转字体大小等),我不晓得如何做到,若有读者能够指导,感激不尽。

2.9. 表格

语法:

| 左对齐 | 右对齐 | 居中对齐 || :---- | ----: | :----: || 单元格 | 单元格 | 单元格 || 单元格 | 单元格 | 单元格 |

如:

| 学生姓名 | 年龄 | 班级 || :---- | ----: | :----: || 刘星     | 14 | 2 || 夏雪     | 17 | 3 |
学生姓名 年龄 班级
刘星 14 2
夏雪 17 3

后记

2019 年夏天,也就是我高考完的那个寒假,哥哥就通知我让我学习 Markdown,说这个很有用也很好用,甚至把 VSCode 都下好了。没想到,近 2 年后,我才感触到它的用途,开始学习它。

正文完
 0