MarkDown学习记录
Published:
这篇博客主要介绍了MarkDown及其基础语法,主要包括标题、段落、换行、强调、引用、列表、链接、图片、表格、代码块等。
MarkDown学习
Markdown 基本语法
Markdown是一种轻量级标记语言,排版语法简洁,让人们更多地关注内容本身而非排版。它使用易读易写的纯文本格式编写文档,可与HTML混编,可导出 HTML、PDF 以及本身的 .md 格式的文件。因简洁、高效、易读、易写,Markdown被大量使用,如Github、Wikipedia、简书等。
Markdown 标题语法
要创建标题,请在单词或短语前面添加 # 。# 的数量代表了标题的级别。
示例
# Heading level 1
## Heading level 2
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6
Markdown 段落语法
要创建段落,请使用空白行将一行或多行文本进行分隔。
示例
I really like using Markdown.
I think I'll use it to format all of my documents from now on.
Markdown 换行语法
在一行的末尾添加两个或多个空格,然后按回车键,即可创建一个换行。
Markdown 强调语法
通过将文本设置为粗体或斜体来强调其重要性。
- 粗体(Bold)
I just love **bold text**.
- 斜体(Italic)
Italicized text is the *cat's meow*.
- 粗体和斜体(Bold & Italic)
This text is ***really important***.
Markdown 引用语法
要创建块引用,请在段落前添加 > 符号。
示例
> Dorothy followed her through many of the beautiful rooms in her castle.
- 嵌套块引用
>> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
> *Everything* is going according to **plan**.
Markdown 列表语法
可以将多个条目组织成有序或无序列表。
- 有序列表
1. First item
2. Second item
3. Third item
1. Indented item
2. Indented item
4. Fourth item
- 无序列表
* First item
* Second item
* Third item
* Fourth item
- 在列表中嵌套其他元素
* This is the first list item.
* Here's the second list item.
>I need to add another paragraph below the second list item.
* And here's the third list item.
Markdown 代码语法
要将单词或短语表示为代码,请将其包裹在反引号 (`) 中。
At the command prompt, type nano.
- 转义反引号 如果你要表示为代码的单词或短语中包含一个或多个反引号,则可以通过将单词或短语包裹在双反引号(``)中。
example Use `code` in your Markdown file. Use code in your Markdown file.
Markdown 分隔线语法
要创建分隔线,请在单独一行上使用三个或多个星号 (***)、破折号 (—) 或下划线 (___) ,并且不能包含其他内容。
example Try to put a blank line before
and after a horizontal rule.
Markdown 链接语法
链接文本放在中括号内,链接地址放在后面的括号中,链接title可选。
example markdown写法 Markdown语法,html写法Markdown语法
Markdown 图片语法
要添加图像,请使用感叹号 (!), 然后在方括号增加替代文本,图片链接放在圆括号里,括号里的链接后可以增加一个可选的图片标题文本。
example markdown写法
html写法
- 链接图片
给图片增加链接,请将图像的Markdown 括在方括号中,然后将链接添加在圆括号中。
Markdown 内嵌 HTML 标签
对于 Markdown 涵盖范围之外的标签,都可以直接在文件里面用 HTML 本身。如需使用 HTML,不需要额外标注这是 HTML 或是 Markdown,只需 HTML 标签添加到 Markdown 文本中即可。
- 行级內联标签 HTML 的行级內联标签如 <span>、<cite>、<del> 不受限制,可以在 Markdown 的段落、列表或是标题里任意使用。依照个人习惯,甚至可以不用 Markdown 格式,而采用 HTML 标签来格式化。例如:如果比较喜欢 HTML 的 <a> 或 <img> 标签,可以直接使用这些标签,而不用 Markdown 提供的链接或是图片语法。当你需要更改元素的属性时(例如为文本指定颜色或更改图像的宽度),使用 HTML 标签更方便些。 HTML 行级內联标签和区块标签不同,在內联标签的范围内, Markdown 的语法是可以解析的。 例如:This word is bold. This word is italic.
区块标签
区块元素──比如 <div>、<table>、<pre>、<p> 等标签,必须在前后加上空行,以便于内容区分。而且这些元素的开始与结尾标签,不可以用 tab 或是空白来缩进。Markdown 会自动识别这区块元素,避免在区块标签前后加上没有必要的 <p> 标签。
example 在 Markdown 文件里加上一段 HTML 表格:
This is a regular paragraph.
| Foo | Bar | |
| Baz | Qux | Quux |
This is another regular paragraph.
Markdown添加latex公式
$\sum_{i=1}^n i^2=1+4+9+16+25+36+49+64+81+100$
$\sum_{i=1}^n i^2=1+4+9+16+25+36+49+64+81+100$
$\alpha$ $\beta$ $\gamma$ $\delta$ $\epsilon$
$\alpha$ $\beta$ $\gamma$ $\delta$ $\epsilon$
Markdown添加代码块
import numpy as np
def f(x):
return x**2
print(f(x))
