table of Contents
Updated: 2019.09.14
1. Introduction
When writing technology blog, we often need to add the code block used for demonstration shows, in fact, in writing this blog, but also need to use a lot of code blocks. Continue following describes the block portion Markdown .
2. Code block
Prior to this, I also mentioned the highlighted text (can be said to put a code block within the line). But if you want to enter a large code, you can use a pair of these codes ( `) come wrapped in order to achieve the desired effect.
Implement particular block of code:
actual effect:
# 生成包含20个0-1随机数的列表
import random
rand_list = []
for i in range(20):
rand_list.append(random.random())
print(rand_list)
3. The reference code
In fact, we can also insert the code in a reference (to use a different number of spaces to indent)
<!--来具体看看例子演示-->
> 这是一段代码
>
> print("hello") # 代码和(>)空了5个空格
>
actual effect:
This is a piece of code
print("hello") # 代码和(>)空了5个空格
4. The list of code blocks
Similarly, blocks of code in the list and also to use almost in a reference block (in Example unordered list)
- 无序列表
print('hello') # 空了5个空格
The following is the actual effect of jupyter notebook:
- ps: in fact, not all editors support such wording wants