标记语法

Edited:   March 26, 2019

基本标记语法

GitHub使用 kramdown 作为GitHub风格的标记(GitHub Flavored Markdown (GFM))。下面列出了一些语法。

排版

*这是斜体.* **这是粗体**. * 如果星号被空格包围,则不会解析星号。 *

_这也是斜体_ __这也是粗体__. _ 如果下划线被空格包围,则不会解析下划线 _

[这是一个外部链接](https://bit.ly). `"https://"` 这很重要。 [这是一个内部链接](#typesetting). 内部链接都是小写,空格替换为连字符"-"。

你可以像这样混合他们 [*this*](https://bit.ly), [`this`](https://bit.ly), **[this](https://bit.ly)**, 但不是 `[this](https://bit.ly)`.

==GFM 不支持高亮显示,但我在此主题上实现了高亮显示。==

这是斜体. 这是粗体. * 如果星号被空格包围,则不会解析星号。 *

这也是斜体 这也是粗体. _ 如果下划线被空格包围,则不会解析下划线 _

这是一个外部链接. "https://" 这很重要。 这是一个内部链接. 内部链接都是小写,空格替换为连字符”-“。

你可以像这样混合他们 this, this, this, 但不是 [this](https://bit.ly).

==GFM 不支持高亮显示,但我在此主题上实现了高亮显示。==

列表

- 这是无序列表
  - 子项
    - 子子项
      - 子子子项
        - 它可以一直这样下去
- 列表可以有多行

  就像这个,
- > 或引号
- ```markdown
  或使用代码
​```

---

1. 这是有序列表
   1. 子项
2. 这也是
3. 它可以一直这样下去

---

1. 您可以避免像这样编号
   1. 子项
1. 它将一直这样下去
1. 歪比巴布
  • 这是无序列表
    • 子项
      • 子子项
        • 子子子项
          • 它可以一直这样下去
  • 列表可以有多行

    就像这个,

  • 或引号

  • markdown 或使用代码 ​

  1. 这是有序列表
    1. 子项
  2. 这也是
  3. 它可以一直这样下去

  1. 您可以避免像这样编号
    1. 子项
  2. 它将一直这样下去
  3. 歪比巴布

图片

Markdown 使用 `![caption](link)` 来引用图片,标题可以自由设置,但你不能控制其大小。

![caption](https://raw.githubusercontent.com/yk-liu/yk-liu.github.io/master/_posts/2018-11-01-Introduction-to-Homology/assets/triangles.png)

所以我更喜欢使用这样的HTML标签:

<img src="https://raw.githubusercontent.com/yk-liu/yk-liu.github.io/master/_posts/2018-11-01-Introduction-to-Homology/assets/triangles.png" width="30%">

Markdown 使用 ![caption](link) 来引用图片,标题可以自由设置,但你不能控制其大小。

caption

所以我更喜欢使用这样的HTML标签:

注意:我咨询了GitHub的支持,关于使用raw.github链接的图片,他们说这样做是可以的。

我可以在我的博客中使用原始链接来显示我的图片吗?

我知道这不是Jekyll推荐的方式。但我想知道你们是否不鼓励这种做法,因为如果我的网站变得更受欢迎,流量会更大。我想知道对原始链接是否有任何流量限制,是否有任何工作方法可以让我保持我的目录结构?

他们是这样回复的:

嗨,

感谢您与我们联系。

我们通常不赞成这种结构,但它在我们这里似乎没有造成任何问题。

此外,在原始链接上没有任何记录的流量限制,我们也不知道有任何变通办法(尽管有可能存在)。

如果流量对我们的系统造成不适当的负荷,我们一定会联系你,但我们愿意回答你关于这方面的任何其他问题。干杯!

万事如意, GitHub员工

区域: 引用区域, 代码区域

> 这是一个引用区域
>
> > 这是引用区域中的引用区域```python
# 这是一个Python代码区域
import numpy as np
print("""这是一个Python代码区域""")
​``````fortran
! 这是一个Fortran代码区域
implicit none
​``````
这是一个简单的代码区域,你可以用它来显示Mono字体的文本
​```

你可以混合使用它们,就像

>```
>这样.
>```

这是一个引用区域

这是引用区域中的引用区域

# 这是一个Python代码区域
import numpy as np
print("""这是一个Python代码区域""")
! 这是一个Fortran代码区域
implicit none
这是一个简单的代码区域,你可以用它来显示Mono字体的文本

你可以混合使用它们,就像

这样.

表格

| 这一栏是左对齐的 | 这一栏是居中的 | 这一栏是右对齐的 |
| :-------------------------- | :---------------------: | ---------------------------: |
| 1                           |            4            |                            7 |
| 2                           |            5            |                            8 |
| 3                           |            6            |                            9 |

| 你可以在表格中使用 `![caption](link)`                     | 你可以在表格中使用数学 |  你可以在表格中使用`<img src="" width="">` .               |
| ------------------------------------------------------------ | --------------------------- | ------------------------------------------------------------ |
| ![caption](https://raw.githubusercontent.com/yk-liu/yk-liu.github.io/master/_posts/2018-11-01-Introduction-to-Homology/assets/triangles.png) | $1+1=2$                     | <img src="https://raw.githubusercontent.com/yk-liu/yk-liu.github.io/master/_posts/2018-11-01-Introduction-to-Homology/assets/triangles.png" width="30%"> |
这一栏是左对齐的 这一栏是居中的 这一栏是右对齐的
1 4 7
2 5 8
3 6 9

| 你可以在表格中使用 ![caption](link) | 你可以在表格中使用数学 | 你可以在表格中使用<img src="" width=""> . | | ———————————————————— | ————————— | ———————————————————— | | caption | $1+1=2$ | |

Mathjax

这是内联数学 $sum_{i=1}^{N} i $。 这是显示数学。

$$
\sum_{i=1}^{N} i 
$$

[Mathjax](http://docs.mathjax.org/en/latest/tex.html)的语法就像latex。你不能使用`\usepackge`,但你可以使用`\newcommand`,像这样 

$$
\newcommand{\NewOp}[2]{\lbrace{#1}\mid \otimes{#2}\rbrace}
$$

而`\NewOp`将在以后的所有数学块中可用,无论是内联的$NewOp{x}{y}$还是显示的

$$
\NewOp{x}{y}
$$

对数学中的竖条符号和下划线要**非常小心** 。如果你像$|x|ge 0$、$|0|=0$那样使用它,或者像$\lbrace x | x\gt 0\rbrace$那样使用它,你会得到一堆胡言乱语。

Use `\vert` in $\vert x\vert\ge 0$, $\vert 0\vert=0$. 在$lbrace x \mid x\gt 0$中使用`\mid`代替。

同样使用下划线,如$x_1$, $x_2$, $x_{c_2}^{c_3}$, 与$y_{c_2}^{c_3}$, 将被处理为_this_。

用空格包裹下划线,像这样 $x _ 1$, $x _ 2$, $x _ {c _ 2}^{c _ 3}$, 与 $y _ {c _ 2}^{c _ 3 }$。

这是内联数学 $sum_{i=1}^{N} i $。 这是显示数学。

\[\sum_{i=1}^{N} i\]

额外的空行很重要,否则你将会得到以下结果 \(\sum_{i=1}^{N} i\)

Mathjax的语法就像latex。你不能使用\usepackge,但你可以使用\newcommand,像这样

\[\newcommand{\NewOp}[2]{\lbrace{#1}\mid \otimes{#2}\rbrace}\]

\NewOp将在以后的所有数学块中可用,无论是内联的$NewOp{x}{y}$还是显示的

\[\NewOp{x}{y}\]

Mermaid图

不支持使用GFM,现用JavaScript实现。

​```mermaid
  graph LR;
    
  A[嗨!] --> B{这}
  B --> C(是一个)
  C --> D((流程图!))
​```
  graph LR;
   A[嗨!] --> B{这}
  B --> C(是一个)
  C --> D((流程图!))

标题

# 标题 1

## 标题 2

### 标题 3

#### 标题 4

##### 标题 5

###### 标题 6

标题 1

标题 2

标题 3

标题 4

标题 5
标题 6

对博主的善意提醒

Mathjax 的陷阱

do not use {{ anywhere in your math. Say \bra{{-2}^\psi} use { { instead. Jekyll will parse that as liquid tags. You can do that by replacing.

  1. do not use x_1 in inline math, write that as x _ 1. Jekyll will parse that as italic fonts. You can do that by replacing, but be careful that some of the links contains _ so make sure you correct those links afterwards.
   Using underscores like this $x_1$, $x_2$, $x_{c_2}^{c_3}$, with $y_{c_2}^{c_3}$, will be processed as _italic_.

   Wrap underscores with whitespaces like this $x _ 1$, $x _ 2$, $x _ {c _ 2}^{c _ 3}$, with $y _ {c _ 2}^{c _ 3 }$.

Using underscores like this $x_1$, $x_2$, $x_{c_2}^{c_3}$, with $y_{c_2}^{c_3}$, will be processed as italic.

Wrap underscores with whitespaces like this $x _ 1$, $x _ 2$, $x _ {c _ 2}^{c _ 3}$, with $y _ {c _ 2}^{c _ 3 }​$.

  1. Be **very careful** with the vertical bar symbol and underscore in math. If you use it like $|x|\ge 0$, $|0|=0$, or like $\lbrace x | x\gt 0\rbrace$, you will get a bunch of gibberish.
       
    Use `\vert` in $\vert x\vert\ge 0$, $\vert 0\vert=0$. Use `\mid` in $\lbrace x \mid x\gt 0​$ instead.
    
    Be very careful with the vertical bar symbol and underscore in math. If you use it like $ x \ge 0$, $ 0 =0$, or like $\lbrace x x\gt 0\rbrace​$, you will get a bunch of gibberish.

    Use \vert in $\vert x\vert\ge 0$, $\vert 0\vert=0$. Use \mid in $\lbrace x \mid x\gt 0\rbrace$ instead.

  2. Use \newline instead of \\ in inline math. \substack is a very useful command.

  3. The extra empty line of displaymath matters, or you will end up with
    $$
    \sum_{i=1}^{N} i
    $$
    

    The extra empty line matters, or you will end up with \(\sum_{i=1}^{N} i\)

YAML front matter pitfalls

Don’t use [ ] in YAML front matter.

Don’t use : in YAML front matter. If you have to, use pipe line:

title: >
   The Matrix II: Reload

<img src="" width=80%> will be rendered by typora but Jekyll only renders <img src="" width="80%">

Foot Notes

This is a note1. Footnotes can have captions like2. You can reference to the same note multiple times like2. Foot notes can have many other options like3. Or just like 4. This is a [reference style link][linkid] to a page. And [this][linkid] is also a link. As is [this][] and [that].

Foot Notes

The Foot notes are like this

    as well as code blocks
  1. https://xuyang233.github.io 

  2. https://xuyang233.github.io  2

  3. Blockquotes can be in a footnote.

  4. or, naturally, simple paragraphs.