0%

Begin with Markdown 2

[TOC]

< !–more–>

Content

Put [TOC] in the position where you want to generate content. This it can caputere headings(heading 1-6) automaticly.

Table

1
2
3
4
5
6
7
8
9
|heading one|heading two| headng three|
|:---|---:|:---:|
|:- left|-: right|:-: center|
|>|a|b|
|a|>|b|
|a|b|>|
|^|c|d|
|c|^|d|
|c|d|^|

Code

Inline

Embed code into text and sentences with ‘``’. text your code/command text.

Block

Format

1
2
3
4
5
6
```language {cmd=yourcmd, option1=value1, op2=v2,...}
...code...
code...
...

```

options:

  • cmd: do you run the code? (if running, there will be results)
  • hide: do you hide the code?
  • output: html/text/markdown/png
  • other options

Python

  1. default(no commands)

source code:

1
2
3
```python
print("hello world")
```

display after markdown rendering:

1
print("hello world")
  1. run code

Enable Script Excution
source code:

1
2
3
```python {cmd=true}
print("hello world")
```

display after markdown rendering:

  1. run and hide code (only display running results)

source code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
```python {cmd hide}s

def bubble_sort_v3(array =[]):
last_exchange_index = len(array)-1
for i in range(len(array)-1):
for j in range(last_exchange_index):
if array[j] > array[j+1]:
temp = array[j]
array[j] = array[j+1]
array[j+1] = temp
last_exchange_index = j # important

if last_exchange_index == 0:
break

my_array = [-1, 5, 3, -1, 6, 7, 8, 2, 2, -14, 10, 12]
bubble_sort_v3(my_array)
print(my_array)
```

  1. matplotlib
  • set matplotlib=true
  • cmd=true/your_interpreter_path
    source code:
1
2
3
4
5
```python {cmd="D:/software/anaconda/next/envs/LiziX/python.exe" matplotlib=true}
import matplotlib.pyplot as plt
plt.plot([1,2,3,6, 10])
plt.show()
```

Bash

source code:

1
2
3
4
5
```bash
hexo s
hexo clean
hexo d -g
```

display after markdown rendering:

1
2
3
hexo s
hexo clean
hexo d -g

Mermaid

Plase click blog 3.

Math

  • support LaTex math syntax
  • inline: $math_formula$ or \(math_formula\)
  • block: $$math_formula$$ or \[math_formula\]
1
2
3
4
5
6
```markdown
$r(\theta) = 1-sin(\theta)$
\(r(\theta) = 1-sin(\theta)\)
$$r(\theta) = 1-sin(\theta)$$
\[r(\theta) = 1-sin(\theta)\]
```

-------------End of blogThanks for your reading-------------