文章

Text and Typography

Examples of text, typography, math equations, diagrams, flowcharts, pictures, videos, and more.

Headings

H1 - heading

H2 - heading

H3 - heading

H4 - heading

Paragraph

Quisque egestas convallis ipsum, ut sollicitudin risus tincidunt a. Maecenas interdum malesuada egestas. Duis consectetur porta risus, sit amet vulputate urna facilisis ac. Phasellus semper dui non purus ultrices sodales. Aliquam ante lorem, ornare a feugiat ac, finibus nec mauris. Vivamus ut tristique nisi. Sed vel leo vulputate, efficitur risus non, posuere mi. Nullam tincidunt bibendum rutrum. Proin commodo ornare sapien. Vivamus interdum diam sed sapien blandit, sit amet aliquam risus mattis. Nullam arcu turpis, mollis quis laoreet at, placerat id nibh. Suspendisse venenatis eros eros.

Lists

Ordered list

  1. Firstly
  2. Secondly
  3. Thirdly

Unordered list

  • Chapter
    • Section
      • Paragraph

ToDo list

  • Job
    • Step 1
    • Step 2
    • Step 3

Description list

1
2
3
4
5
Sun
: the star around which the earth orbits

Moon
: the natural satellite of the earth, visible by reflected light from the sun
Sun
the star around which the earth orbits
Moon
the natural satellite of the earth, visible by reflected light from the sun

Block Quote

This line shows the block quote.

Prompts - 提示泡泡

1
2
3
4
5
6
7
8
> An example showing the `tip` type prompt.
{: .prompt-tip }

{: .prompt-info }

{: .prompt-warning }

{: .prompt-danger }

An example showing the tip type prompt.

An example showing the info type prompt.

An example showing the warning type prompt.

An example showing the danger type prompt.

Tables

CompanyContactCountry
Alfreds FutterkisteMaria AndersGermany
Island TradingHelen BennettUK
Magazzini Alimentari RiunitiGiovanni RovelliItaly

http://127.0.0.1:4000

Footnote

1
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].

Click the hook will locate the footnote1, and here is another footnote2.

Inline code

This is an example of Inline Code.

单行代码着色

1
`let val_rust = 123;`{:.language-rust}

let val_rust = 123;

1
`local val_lua = 123`{:.language-lua}

local val_lua = 123

Filepath - 文件路径提示

1
`/path/to/the/file.extend`{: .filepath}.

Here is the /path/to/the/file.extend.

Code blocks

Common

1
This is a common code snippet, without syntax highlight and line number.

Specific Language

1
2
3
4
if [ $? -ne 0 ]; then
  echo "The command was not successful.";
  #do the needful / exit
fi;

Specific filename

1
2
3
@import
  "colors/light-typography",
  "colors/dark-typography";

Mathematics - 数学符号

在文章开头需添加 math: true

Ref >> url

The mathematics powered by MathJax:

1
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
\[\sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6}\]
1
2
3
4
5
6
$$
\begin{equation}
  \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6}
  \label{eq:series}
\end{equation}
$$
\[\begin{equation} \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} \label{eq:series} \end{equation}\]

We can reference the equation as \eqref{eq:series}.

When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are

  • $ a \ne 0 $
  • $ ax^2 + bx + c = 0 $
1
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}\]

希腊字母

  • 如果要大写希腊字母,则首字母大写即可,如\Gamma显示为 $ \Gamma $
  • 如果要使希腊字母显示为斜体,则前面添加var即可,如\varGamma显示为 $ \varGamma $
显示命令显示命令
\(\alpha\)\alpha\(\beta\)\beta
\(\gamma\)\gamma\(\delta\)\delta
\(\epsilon\)\epsilon\(\zeta\)\zeta
\(\eta\)\eta\(\theta\)\theta
\(\iota\)\iota\(\kappa\)\kappa
\(\lambda\)\lambda\(\mu\)\mu
\(\nu\)\nu\(\xi\)\xi
\(\pi\)\pi\(\rho\)\rho
\(\sigma\)\sigma\(\tau\)\tau
\(\upsilon\)\upsilon\(\phi\)\phi
\(\chi\)\chi\(\psi\)\psi
\(\omega\)\omega  

矢量

单字母向量:

  • \vec a = $ \vec a $
  • \overrightarrow a = $ \overrightarrow a $

多字母向量:

  • \vec {ab} = $ \vec {ab} $
  • \overrightarrow {ab} = $ \overrightarrow {ab} $

Mermaid SVG - 绘图

1
mermaid: true

sequenceDiagram - 序列图

1
2
3
4
5
sequenceDiagram
    Alice->>+John: Hello John, how are you?
    Alice->>+John: John, can you hear me?
    John-->>-Alice: Hi Alice, I can hear you!
    John-->>-Alice: I feel great!
sequenceDiagram
    Alice->>+John: Hello John, how are you?
    Alice->>+John: John, can you hear me?
    John-->>-Alice: Hi Alice, I can hear you!
    John-->>-Alice: I feel great!

flowchart - 流程图

1
2
3
4
5
6
flowchart TD
    A[Christmas] -->|Get money| B(Go shopping)
    B --> C{Let me think}
    C -->|One| D[Laptop]
    C -->|Two| E[iPhone]
    C -->|Three| F[fa:fa-car Car]
flowchart TD
    A[Christmas] -->|Get money| B(Go shopping)
    B --> C{Let me think}
    C -->|One| D[Laptop]
    C -->|Two| E[iPhone]
    C -->|Three| F[fa:fa-car Car]

classDiagram - 类图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
      +String beakColor
      +swim()
      +quack()
    }
    class Fish{
      -int sizeInFeet
      -canEat()
    }
    class Zebra{
      +bool is_wild
      +run()
    }
classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
      +String beakColor
      +swim()
      +quack()
    }
    class Fish{
      -int sizeInFeet
      -canEat()
    }
    class Zebra{
      +bool is_wild
      +run()
    }

stateDiagram - 状态图

1
2
3
4
5
6
7
stateDiagram-v2
    [*] --> Still
    Still --> [*]
    Still --> Moving
    Moving --> Still
    Moving --> Crash
    Crash --> [*]
stateDiagram-v2
    [*] --> Still
    Still --> [*]
    Still --> Moving
    Moving --> Still
    Moving --> Crash
    Crash --> [*]

erDiagram - 关系图

1
2
3
4
5
6
7
8
9
erDiagram
    CUSTOMER }|..|{ DELIVERY-ADDRESS : has
    CUSTOMER ||--o{ ORDER : places
    CUSTOMER ||--o{ INVOICE : "liable for"
    DELIVERY-ADDRESS ||--o{ ORDER : receives
    INVOICE ||--|{ ORDER : covers
    ORDER ||--|{ ORDER-ITEM : includes
    PRODUCT-CATEGORY ||--|{ PRODUCT : contains
    PRODUCT ||--o{ ORDER-ITEM : "ordered in"
erDiagram
    CUSTOMER }|..|{ DELIVERY-ADDRESS : has
    CUSTOMER ||--o{ ORDER : places
    CUSTOMER ||--o{ INVOICE : "liable for"
    DELIVERY-ADDRESS ||--o{ ORDER : receives
    INVOICE ||--|{ ORDER : covers
    ORDER ||--|{ ORDER-ITEM : includes
    PRODUCT-CATEGORY ||--|{ PRODUCT : contains
    PRODUCT ||--o{ ORDER-ITEM : "ordered in"

gantt - 甘特图

 gantt
  title  Adding GANTT diagram functionality to mermaid
  apple :a, 2017-07-20, 1w
  banana :crit, b, 2017-07-23, 1d
  cherry :active, c, after b a, 1d
 gantt
  title  Adding GANTT diagram functionality to mermaid
  apple :a, 2017-07-20, 1w
  banana :crit, b, 2017-07-23, 1d
  cherry :active, c, after b a, 1d

journey - 日程

1
2
3
4
5
6
7
8
9
journey
    title My working day
    section Go to work
      Make tea: 5: Me
      Go upstairs: 3: Me
      Do work: 1: Me, Cat
    section Go home
      Go downstairs: 5: Me
      Sit down: 3: Me
journey
    title My working day
    section Go to work
      Make tea: 5: Me
      Go upstairs: 3: Me
      Do work: 1: Me, Cat
    section Go home
      Go downstairs: 5: Me
      Sit down: 3: Me

gitGraph

1
2
3
4
5
6
7
8
9
10
11
gitGraph
    commit
    commit
    branch develop
    checkout develop
    commit
    commit
    checkout main
    merge develop
    commit
    commit
gitGraph
    commit
    commit
    branch develop
    checkout develop
    commit
    commit
    checkout main
    merge develop
    commit
    commit

pie - 饼图

1
2
3
4
pie title Pets adopted by volunteers
    "Dogs" : 386
    "Cats" : 85
    "Rats" : 15
pie title Pets adopted by volunteers
    "Dogs" : 386
    "Cats" : 85
    "Rats" : 15

mindmap - 脑图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mindmap
  root((mindmap))
    Origins
      Long history
      ::icon(fa fa-book)
      Popularisation
        British popular psychology author Tony Buzan
    Research
      On effectivness<br/>and features
      On Automatic creation
        Uses
            Creative techniques
            Strategic planning
            Argument mapping
    Tools
      Pen and paper
      Mermaid
mindmap
  root((mindmap))
    Origins
      Long history
      ::icon(fa fa-book)
      Popularisation
        British popular psychology author Tony Buzan
    Research
      On effectivness<br/>and features
      On Automatic creation
        Uses
            Creative techniques
            Strategic planning
            Argument mapping
    Tools
      Pen and paper
      Mermaid

quadrantChart - 象限图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
quadrantChart
    title Reach and engagement of campaigns
    x-axis Low Reach --> High Reach
    y-axis Low Engagement --> High Engagement
    quadrant-1 We should expand
    quadrant-2 Need to promote
    quadrant-3 Re-evaluate
    quadrant-4 May be improved
    Campaign A: [0.3, 0.6]
    Campaign B: [0.45, 0.23]
    Campaign C: [0.57, 0.69]
    Campaign D: [0.78, 0.34]
    Campaign E: [0.40, 0.34]
    Campaign F: [0.35, 0.78]
quadrantChart
    title Reach and engagement of campaigns
    x-axis Low Reach --> High Reach
    y-axis Low Engagement --> High Engagement
    quadrant-1 We should expand
    quadrant-2 Need to promote
    quadrant-3 Re-evaluate
    quadrant-4 May be improved
    Campaign A: [0.3, 0.6]
    Campaign B: [0.45, 0.23]
    Campaign C: [0.57, 0.69]
    Campaign D: [0.78, 0.34]
    Campaign E: [0.40, 0.34]
    Campaign F: [0.35, 0.78]

Images

Default (with caption)

Desktop View Full screen width and center alignment

Left aligned

Desktop View

Float to left

Desktop View Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.

Float to right

Desktop View Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.

Dark/Light mode & Shadow

The image below will toggle dark/light mode based on theme preference, notice it has shadows.

light mode only dark mode only

Video

运行代码显示结果

1
2
3
4
5
6
```rust
fn main() {
    println!("hello world");
}
```
{: run="rust" }
1
2
3
fn main() {
    println!("hello world");
}

语言支持情况:

已支持的语言run="lang" 参数后端
C++run="cpp"Coliru
JavaScriptrun="javascript"N/A (本地)
Pythonrun="python"Online Python
Rustrun="rust"Rust Playground

代码块高亮

1
2
3
4
5
6
```c
int main(int argc, char* argv[]) {
   return 0;
}
```
{: highlight-lines="2" }
1
2
3
int main(int argc, char* argv[]) {
   return 0;
}
1
2
3
4
5
6
7
```plaintext
由于 Rouge 的特性,不会对纯文本代码段进行分割,
因此虽然该代码段有很多行,但是 Rouge 会使用一整个 #text 来包装他们。
这也是为什么我们需要先将元素以 `\n` 分割为多个元素,
否则像这样的纯文本,很难对其进行行高亮。
```
{: highlight-lines="2" }
1
2
3
4
由于 Rouge 的特性,不会对纯文本代码段进行分割,
因此虽然该代码段有很多行,但是 Rouge 会使用一整个 #text 来包装他们。
这也是为什么我们需要先将元素以 `\n` 分割为多个元素,
否则像这样的纯文本,很难对其进行行高亮。

Reverse Footnote

1
2
[^footnote]: The footnote source
[^fn-nth-2]: The 2nd footnote source

点击后显示

Click to view features
  • Dark / Light Theme Mode
  • Dark / Light Theme Mode
1
2
3
4
5
6
7
8
9
<details>
  <summary>
    <i>Click to view features</i>
  </summary>
  <ul>
	  <li> Dark / Light Theme Mode </li>
   	  <li> Dark / Light Theme Mode </li>
    </ul>
</details>
  1. The footnote source 

  2. The 2nd footnote source 

本文由作者按照 CC BY 4.0 进行授权