Markdown初练习 -- 基本语法

chenzhang's Blog / 2023-08-23 / 原文

标题语法

# 一级标题

## 二级标题

### 三级标题  有几个 `#` 就是几级标题,以此类推


在文字下方输入多个 `=` 实现的一级标题
======

在文字下方输入多个 `-` 实现的一级标题
-------

段落

I really like using

markdown.

对于段落之间,需要使用空白行将一行或多行文本分开。
I think I'll use it to
format all of my documents
from now on.

换行

在一行的末尾添加两个及以上的空格,然后回车即可创建一个换行(`<br>`)。
This is the first line.  
And this is the second line.

强调

粗体

可以使用两对`*`或两对`_`来实现文字的粗体
I just love **bold
text**.

I just love __bold
text__.

Love **is** bold

斜体

可以使用一对`*`或一对`_`来实现文字的粗体
Italicized text is the *cat's meow*.

Italicized text is the _cat's meow_.

A *cat* meow

同时使用粗体和斜体

可以使用三对`*`或三对`_`来同时实现文字的粗体和斜体
This text is ***really
important***.

This text is _**really
important**_.

引用

单个块

要创建块引用,请在段落前添加一个 `>` 符号。
>Dorothy followed her through many of the beautiful rooms in her castle.

多个块

块引用可以包含多个段落。为段落之间的空白行添加一个 `>` 符号。
> Dorothy followed her through many of the beautiful rooms in her castle.
>
> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

嵌套块

块引用可以嵌套。在要嵌套的段落前添加一个 `>>` 符号。
> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

带有其它元素

块引用可以包含其他 Markdown 格式的元素。并非所有元素都可以使用,你需要进行实验以查看哪些元素有效。
> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
>  *Everything* is going according to **plan**.

列表

有序列表

1. First item
2. Second item
3. Third item
4. Fourth item 

无序列表

- 无序列表 - 1
- 无序列表 - 2
- 无序列表 - 3 

* First item
* Second item
* Third item

+ First item
+ Second item
+ Third item

无序列表嵌套

* This is the first list item.
* Here's the second list item.  
	I need to add another paragraph below the second list item.
* And here's the third list item.

嵌套其它元素

段落

*   This is the first list item.
*   Here's the second list item.

    I need to add another paragraph below the second list item.

*   And here's the third list item.

引用块

* This is the first list item.
* Here's the second list item.  
	
	>A blockquote would look great below the second list item.

* And here's the third list item.

代码块

1. Open the file.

2. Find the following code block on line 21:

	<html>
		<head>
			<title>Test</title>
		</head>
	</html>

3. Update the title to match the name of your website.

图片

1.  Open the file containing the Linux mascot.
2.  Marvel at its beauty.

    ![Tux, the Linux mascot](${photo}/tux.png)

3.  Close the file.

列表

1. First item
2. Second item
3. Third item
   - Indent item
   - Indent item
4. Fourth item

代码

单词或短语代码

At the command prompt, type `nano`.

转义反引号

``Use `code` in your Markdown file.``

代码块

	<html>
		<head>
		</head>
	</html>

分割线语法

要创建分隔线,请在单独一行上使用三个或多个星号 (`***`)、破折号 (`---`) 或下划线 (`___`) ,并且不能包含其他内容。
***
---
___________________

链接

给链接增加 Title

链接title是当鼠标悬停在链接上时会出现的文字,这个title是可选的,它放在圆括号中链接地址后面,跟链接地址之间以空格分隔。	

这是一个链接 [Markdown语法](https://markdown.com.cn "最好的markdown教程")。

网址和Email地址

使用尖括号可以很方便地把URL或者email地址变成可点击的链接。
<https://markdown.com.cn>

<fake@example.com>

带格式化的链接

I love supporting the **[EFF](htttps://eff.org)**.

This is the *[Markdown Guide](https://www.markdownguide.org)*.

See the section on [`code`](#code).

引用类型链接

[hobbit-hole][1]

[1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle

图片

基本图片

![这是图片](https://s1.ax1x.com/2023/08/23/pPYpqz9.jpg)

这是图片

链接图片

[![这是加了外链的图片](https://s1.ax1x.com/2023/08/23/pPYpqz9.jpg)](https://imgse.com/i/pPYpqz9)

这是加了外链的图片

转义字符

常用字符转义

\* Without the backslash, this would be a bullet in an unordered list.

特殊字符自动转义

http://images.google.com/images?num=30&q=larry+bird
需改写为
http://images.google.com/images?num=30&amp;q=larry+bird
才可放入链接标签href属性中

对于  
4 < 5
Markdown 将转换为
4 &lt; 5