Introduction to common syntax of markdown files in .md format

Usually when writing a project, I often write some descriptive files such as README, but such files are generally .md files, and the syntax of writing is naturally different from other formats. As for why this format is used The file, the ghost knows, everyone uses it like this, just follow it.

The following introduces some commonly used markdown syntax, which I know so much. Moreover, I will not introduce different tags that implement the same style. I think the best use scheme is that there is no need to know every tag, the same style We only agree to use one markup format. One point is that the code written is more standardized, and the two are to reduce the pressure when learning and memorizing.

In fact, these grammars in markdown documents will be interpreted as HTML code, so if your HTML is good, you can write HTML and CSS code in it, and the corresponding styles will be displayed.

The interesting thing about markdown is that it looks different in different interpreters, so don't pay too much attention to the details of the style displayed when learning, these things depend on the interpreter.

text

The body content of markdown is easy to write, just write it according to an HTML document; but you don't need to write those boilerplate codes, just write ordinary text or the HTML tags and css styles we want to embed.

The line break of markdown documents is similar to HTML. When you type a line break, it will act as if nothing happens. If you want a line break, you can use HTML <br> tags or a blank line between two paragraphs of text.

title

Use n # and a space to indicate an n-level heading.

E.g:

# 一级标题
## 二级标题
### 三级标题

list

unordered list

Use * plus a space to indicate, you can also use + - to indicate, which is the same as *. It is recommended to use the one you like in the document, and not to mix multiple tags in a set of lists, which may be interpreted as different sets of lists in different interpreters.

Code:

* 1 
* 2
- 3
- 4
+ 5
+ 6

style:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

ordered list

Use normal numbers plus a . and a space. Some interpreters will increment the number of ordered lists according to the numerical order of the first line of the list, and some will increment from 1 by default.

Code:

1. 1
2. 2
3. 3

style:

  1. 1
  2. 2
  3. 3

Code:

3. 3
2. 2
1. 1

Styles in the blog:

  1. 3
  2. 2
  3. 1

markdown interpreter style:

block reference

The block reference is represented by >. For the aesthetics of the code, we also add a space after it.

Code:

> 这是一个区块引用

> 这是另一个区块引用
>> 这是一个二级嵌套引用
>>> 这是一个三级嵌套引用

Styles in the blog:

This is a block quote

This is a block quote

This is a second level nested reference

This is a three-level nested reference

markdown interpreter style:

Link

In-line expression

The inline link format is: the text of the link is placed in [], and the link address is placed in the following ().

Code:

[我的博客](https://my.oschina.net/epoch/home)

经常出现的列表链接就应该这样写
* [Django介绍与框架整合,并使用MySQL实现增删改查](https://my.oschina.net/epoch/blog/1788273)
* [Python3的介绍、安装和命令行的认识](https://my.oschina.net/epoch/blog/1787262)
* ...

style:

my blog

Frequently appearing list links should be written like this

Parametric

The link can also have the title attribute. It seems that it can only carry the title, but not other attributes. Note that there is a space after the link address, and then it is enclosed in quotation marks.

Code:

[blog]: https://my.oschina.net/epoch/home "我的博客"

这是我的[blog],我想看到我的中文提示[我的博客](https://my.oschina.net/epoch/home "KevinBruce的博客")

style:

this is my blog , i want to see my chinese tips on my blog

If we may use this link multiple times in the text, we can separate it out to define the label name; if we only use it once, we can use the inline type directly.

picture

The usage is basically the same as the link, the only difference is that you need to write one in front of the picture! (this is a must), nothing to say.

In-line expression

Code:

![我的图片](https://static.oschina.net/uploads/user/1808/3617290_100.jpeg?t=1523231638000 "我的开源中国博客logo")

style:

my picture

Parametric

Code:

[我的logo]: https://static.oschina.net/uploads/user/1808/3617290_100.jpeg?t=1523231638000 "我的开源中国博客logo"

这是参数式的引用![我的logo]

style:

This is a parametric referencemy logo

code block

one-line code block

If the amount of code is relatively small, only a single line, it can be enclosed in single backticks. The backtick is the key below the esc key on the keyboard.

Code:

`<p>这是一个代码块</p>`

style:

<p>这是一个代码块</p>

multi-line code block

If there is more code than can be written on a single line, you can use three backticks to quote the code block. You can also use a tab or four spaces to represent code

```这里可以写注释,这些内容不会显示在页面的。
这里还可以写多行
还可以写一行
还可以写更多
```

style:

这里还可以写多行
还可以写一行
还可以写更多

sheet

The format of the table does not have to be perfectly aligned, but in order to look good, the alignment must be the best. The colon after the dividing line indicates the alignment. Writing on the left indicates left alignment, the right side indicates right alignment, and both sides indicate centering, or Interesting.

Code:

|  姓名 | 年龄 |  性别 |
|:-----|-----:|:-----:|
|Kevin |  18  |   男  |
|Jack  |  17  |   女  |
|Bruce |  19  |   男  |

style:

Name age gender
Kevin 18 male
Jack 17 Female
Bruce 19 male

divider

The dividing line can be represented by at least 3 symbols of the 3 symbols * - _ (asterisk, minus sign, bottom line). Note that at least 3 symbols are required, and they do not need to be continuous. Spaces are also possible, but the maximum number between the two symbols is There can only be one space. It is recommended to use the minus sign - to indicate

Code:

---
_ _ _
* **

style:

strikethrough

Code:

~~删除我吧~~

style:

delete me

escape

Escape is to convert some special characters into normal display, which is represented by backslash (\) as in most programming languages. A few are listed below.

Code:

* \\
* \`
* \*
* \!

style:

  • \
  • `
  • *
  • !

emphasize

If an asterisk or an underscore is enclosed, it will be converted to <em> italic, and if it is 2, it will be converted to <strong> bold

Code:

*字体倾斜*
_字体倾斜_

**字体加粗**
__字体加粗__

style:

font italic  font italic

bold  font bold font

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324390095&siteId=291194637