Other markdown grammars can also be used within the referenced chunks, including headings, lists, blocks of code, and so on:
As you can see from the above example, there are spaces between more than three tags, and these three kinds of tags can be mixed, as long as three of the number is added up to or equal to 3, such as the following:
**---*_***--_
EmphasizeWe know there are two tags that play an important role in HTML: <em>
and <strong>
, the difference between the two can be Google or read this article "em and strong difference",markdown also have these two emphasis effect, using the asterisk *
and the bottom line _
these two kinds of tags.
Markdown Syntax Description:
- The use
*
of one or the _
surrounding words, the equivalent <em>
of a label surrounded (this is the transformation of the internal);
*
If you use two or _
wrap, it is equivalent to use <strong>
.
Example:
*使用一个星号的强调*_使用一个 底线 的强调_**使用两个星号的强调**__使用两个底线 的强调__
The corresponding HTML syntax:
<em>使用一个星号的强调</em><em>使用一个底线的强调</em><strong>使用两个星号的强调</strong><strong>使用两个底线的强调</strong>
Effect:
Use an asterisk to emphasize
Use a bottom line of emphasis
Emphasis with two asterisks
Use two bottom-line emphasis
Precautions:
- There is
**
__
no blank space between the two and the same symbols, otherwise they will only be treated as normal symbols .
- The
<em>
emphasis of attention in different editors or browsers may show the effect is not the same, some through italic to emphasize, and some through the next line to emphasize.
ListMarkdown supports both sequential and unordered tables, and lists can be nested. unordered List
Markdown Syntax Description:
Unordered lists use asterisks, plus signs, or minus signs as list markers, using the following methods:
一个星号 / 一个加号 / 一个减号 + 若干个空格 + 列表项内容
Example:
* 条目1* 条目2* 条目3
This is equivalent to:
+ 条目1+ 条目2+ 条目3
is also equivalent to:
- 条目1- 条目2- 条目3
The corresponding HTML syntax:
<ul> <li>条目1</li> <li>条目2</li> <li>条目3</li></ul>
Effect:
Ordered listMarkdown Syntax Description:
There are sequential tables that use numbers directly as list markers, using the following methods:
一个数字 + 一个英文句点 + 若干个空格 + 列表项内容
Example:
1.1th description
2.2nd description
3.3rd Description
The corresponding HTML syntax:
<ol> <li>第1点描述</li> <li>第2点描述</li> <li>第3点描述</li></ol>
Effect:
- 1th description
- 2nd description
- 3rd Description
Precautions(1) from the HTML syntax format of the sequence list, you can see that the numbers you use on the ordered listing tags do not affect the final sequential output , that is, if your list tag is written as:
1. 第1点描述1. 第2点描述1. 第3点描述
or even:
4. 第1点描述2. 第2点描述9. 第3点描述
Will get exactly the same output as above, you can completely ignore the correctness of the numbers.
(2) After the list tag must be followed by at least one space or tab , otherwise it is normal text instead of the list, that is, the following wording is not supported by the list:
*条目1*条目2*条目3
(3) If the list entries are separated by a blank line, then there will be a blank line between the two entries in the output, and if there are multiple entries, if there is a blank line in it, the output will appear blank lines between all entries, maintaining consistency. For example:
* 条目1* 条目2* 条目3
The output effect is:
(4) Each list entry can contain more than one paragraph, but these paragraphs must be indented with 4 spaces or 1 tabs:
1. 这是一个有两个段落的列表项,这是第一段。 这是第二段,段首已经缩进 4 个空格或 1 个制表符,否则就处在列表之外,自成一个普通段落,下面的列表条目也将自成另一个不同的列表,序号从1开始。2. 这是列表的第二个条目。
The effect is:
This is a list entry with two paragraphs, which is the first paragraph.
This is the second paragraph, the beginning of the paragraph has been indented 4 spaces or 1 tabs, otherwise in the list, as a normal paragraph, the following list entry will also be a different list, the sequence number starting from 1.
This is the second entry in the list.
(5) If you want to put a reference within a list entry, you >
need to indent:
* 含有引用的列表项,下面是引用元素: > 这是一条引用。 > 前面需要缩进4个空格或1个制表符,跟段落一样。
The effect is:
(6) If you want to place a block of code within a list item, the chunk needs to be indented two times , which is 8 spaces or 2 tabs:
* 含有代码块的列表项: #include <stdio.h> int main(void) { printf("Hello, Minmin!\n"); return 0; } }
The effect is:
List items that contain code blocks:
#include <stdio.h> int main(void) { printf("Hello, Minmin!\n"); return 0; }}
(7) Avoid creating unnecessary list items.
Sometimes the list is likely to be accidentally generated, such as the following:
1986. 这不是一个列表项。
A list of the following is also generated:
- This is not a list item.
In other words, the number-period-blank appears at the beginning of the line, and to avoid this, you can precede the period with a backslash, and see the "Use of backslashes" section later.
1986\. 这不是一个列表项。
That's right:
1986. This is not a list item. Link
Markdown links can be divided into automatic links and two types of plain text links . Auto link (clickable URL and email)
Markdown supports the processing of URLs and e-mail boxes in a relatively short form of automatic linking.
Markdown Syntax Description:
For the text itself is a URL and email, as long as it is wrapped in angle brackets, markdown will automatically turn it into a link.
Example:
这是一个可点击的URL:
The corresponding HTML syntax:
For the above normal Url,markdown will be converted to the following HTML syntax:
<a href="http://www.csdn.net/">http://www.csdn.net/</a>
The automatic link to email is very similar, but Markdown will do a code conversion process, the text character into a 16-digit HTML entity, this format can fool some bad mail collection robot, for example, the above Email,markdown will be converted to:
<a href="mailto:addre ss@example.com">address@example.com</a>
In the browser, this string will eventually turn into the following HTML syntax:
[Email protected]
Effect:
This is a clickable URL:
http://www.csdn.net/
This is a clickable email:
[Email protected]
Precautions:
For the automatic link of mail, use markdown syntax although can deceive a lot of robots, but not all stop, but always better than nothing. In any case, open your mailbox will eventually attract advertising letters.
Plain text LinksMarkdown supports two forms of normal text link syntax: inline and reference two forms. Inline links
Markdown Syntax Description:
The following three forms of syntax are allowed:
[链接文字](链接URL ‘可选的链接title‘)[链接文字](链接URL "可选的链接title")[链接文字](链接URL (可选的链接title))
The detailed description is:
- A square bracket in which the link text is entered;
- Then a round parenthesis, which can contain two parts, separated by a space :
- The URL of the "must" link;
- "Optional" link title text, as long as single quotation marks, double quotation marks or brackets to wrap the title text, plus title, you use the mouse to move to the link text will display the title text, you can use it as a hint of information, Of course you can also use the title attribute.
Example:
更多精彩的内容,可以访问[敏敏的CSDN博客](http://blog.csdn.net/lanxuezaipiao/ "敏敏的博客")(有title属性) 。想更多的了解敏敏,可以访问[敏敏的新浪微博](http://weibo.com/lanxuezaipiao/) (无title属性)。
The corresponding HTML syntax:
<p>更多精彩的内容,可以访问 <a href="http://blog.csdn.net/lanxuezaipiao/" title="敏敏的博客">敏敏的CSDN博客</a>(有title属性) 。</p><p>想更多的了解敏敏,可以访问<a href="http://weibo.com/lanxuezaipiao/">敏敏的新浪微博</a> (无title属性)。</p>
* Effect: *
For more exciting content, you can access the sensitive Sensitive CSDN blog (with the title attribute).
To learn more about sensitive sensitive, you can access sensitive sensitive's Sina Weibo (without the title attribute).
Precautions:
If you are a resource to be linked to the same host, you can use a relative path , for example:
想要进一步了解,请访问 [About](/about/) 页。
Reference linksMarkdown Syntax Description:
[链接文字][链接id][链接id]: 真正的链接URL "可选的title"
You can find that the link text in the reference link is not a parenthesis but another square bracket, in which you fill in the markup to identify the link , note that there are spaces between the two square brackets, and then, anywhere in the document , You can define the link content of this tag.
The link content definition is in the form of:
- A square bracket (which can optionally be indented with up to three spaces), enter the link ID above
- Then a colon
- followed by more than one space or tab
- Then the URL of the link
- Optionally, the title content can be enclosed in single quotes, double quotes, or parentheses, as above
Example:
想知道敏敏都读过哪些书、看过哪些电影吗?请进入[敏敏的豆瓣][id]来了解下吧。[id]: http://www.douban.com/people/44971294/ "敏敏的豆瓣"
The corresponding HTML syntax:
<p>想知道敏敏都读过哪些书、看过哪些电影吗?请进入<a href="http://blog.csdn.net/lanxuezaipiao/" title="敏敏的豆瓣">敏敏的豆瓣</a>来了解下吧。</p>
Effect:
Want to know what books sensitive sensitive have read and what movies they have seen? Please enter the sensitivity of the watercress to understand it.
Precautions:
(1) One known problem is that markdown.pl 1.0.1 ignores the single-quote-wrapped link title, so you can use double quotes or parentheses whenever possible to avoid errors.
(2) Link URLs can also be wrapped in angle brackets, such as:
[id]:
(3) You can also put the title attribute on the next line, you can also add some indentation, if the URL is too long, this will be more beautiful:
[id]: http://blog.csdn.net/lanxuezaipiao/article/details/42554035 "敏敏的2014年总结"
(4) The URL definition is only used when the link is generated, and does not appear directly in the file, as the above effect does not appear in the [id]:
definition of such a URL.
(5) Link discrimination tags can have letters, numbers, blanks, and punctuation, but not case-sensitive , so the following two links are the same:
[链接文本][a][链接文本][A]
(6) There is also an implicit link tagging feature, which allows you to omit the specified link tag, in which case the link tag will be treated as equivalent to the linked text, with an implicit link tag as long as the link text is appended with an empty square bracket, if you want to "Google" link to Google.com, you can simplify it into:
[Google][]
Then define the link content:
[Google]: http://google.com/
(7) The definition of a link can be placed anywhere in the file, I prefer to place the link directly behind the paragraph, you can also put it on the last side of the file, like a note.
A comprehensive example is given below to compare the differences in these links:
How to use inline chaining:
我经常逛的网站或社区有: [CSDN](http://www.csdn.net/ "CSDN")、[知乎] (http://www.zhihu.com/ "知乎")还有[豆瓣](http://www.douban.com/ "豆瓣")。
How to use a reference link:
我经常逛的网站或社区有: [CSDN] [1]、[知乎] [2] 还有[豆瓣] [3]。 [1]: http://www.csdn.net/ "CSDN" [2]: http://www.zhihu.com/ "知乎" [3]: http://www.douban.com/ "豆瓣"
How to use the link name:
我经常逛的网站或社区有: [CSDN] []、[知乎] [] 还有[豆瓣] []。 [csdn]: http://www.csdn.net/ "CSDN" [知乎]: http://www.zhihu.com/ "知乎" [豆瓣]: http://www.douban.com/ "豆瓣"
The above three formulations produce the same effect:
I often visit the site or the community has: CSDN, know there are also watercress.
So here's a question: How do you choose these three types of writing? Which is the best way to do it?
I personally think this is the problem of their own preferences, you see which write comfortable choice which method? However, from the official point of view, more recommended reference to the wording of the link. reference links actually focus not on it is better to write, but it is better to read, compared to the above example, the use of reference to read the article itself is very concise (because the link tag is separate into a paragraph), but in the form of the inside of the look is very bloated, but also easy to read wrong.
Using the Markdown reference link, you can make the file more like the final result of the browser, allowing you to move some tag-related metadata outside the paragraph, and you can add links without interrupting the reading sensation of the article. Code
The code syntax for Markdown is described in two categories: inline code and code block . In-line code
Markdown Syntax Description:
If you want to mark a short line of code, you can ~
wrap it up () with an inverted quotation mark (that is, the button that is followed) `
:
`你要标记的行内代码`
Example:
让我们看看`printf()` 函数有哪些参数。
The corresponding HTML syntax:
<p>让我们看看<code>printf()</code> 函数有哪些参数。</p>
Effect:
Let's take a look at the parameters of the printf()
function.
Precautions:
If you want to insert anti-quotes within a line snippet, you can use multiple anti-quotes to open and close the code snippet:
这是一个反引号 (`)。
You can output the inverted quote normally:
这是一个反引号 (`)。
If you want to insert a normal anti-quote at the beginning or end of the snippet, there will be three consecutive quotes in a single block, and the desired effect is not achieved. At this point, you need to put a blank at the beginning and end of the code snippet, one after the beginning, and one at the end, for example:
这是代码片段中的反引号:`
This will produce the desired effect:
这是代码片段中的反引号:`
code blockProgram-related writing usually has a well-written code block, usually these chunks we do not want it to the general paragraph of the way to the layout of the document (if the general paragraph of the way all the blanks are eliminated), but according to the original appearance, Markdown will use <pre>
and <code>
tags to wrap the code blocks together.
Markdown Syntax Description:
It is easy to create chunks of code in Markdown, simply by indenting 4 spaces or 1 tab characters.
Example:
这是一个普通段落: 这是一个代码区块。
The corresponding HTML syntax:
<p>这是一个普通段落:</p><pre><code>这是一个代码区块。</code></pre>
This first-order indent (4 spaces or 1 tabs) will be removed to give a specific code example.
Example:
下面是一个简单的Java实例: public class Test{ public static void main (String[] args){ System.out.println("欢迎访问lanxuezaipiao!"); }
Effect:
The following is a simple Java instance:
public class Test{ public static void main (String[] args){ System.out.println("欢迎访问lanxuezaipiao!"); }
Precautions:
In the code block, the general Markdown syntax will not be converted, such as an asterisk is just an asterisk, that is, with two asterisks to surround a sentence will not be translated into emphasis, which means you can easily write in the Markdown syntax Markdown grammar-related files, Don't worry, the code contains some special markdown syntax tags.
The use of backslashesMarkdown can use backslashes to insert symbols that have other meanings in the syntax, such as: if you want to emphasize the effect by adding asterisks to the text, you can precede the asterisk with backslashes:
\*重点描述文本\*
The effect is: * Key Description text *
Markdown supports the following symbols preceded by a backslash to help insert a normal symbol rather than a markdown syntax tag:
\ 反斜线` 反引号* 星号_ 底线{} 花括号[] 方括号() 括弧# 井号+ 加号- 减号. 英文句点! 惊叹号
ProblemsQuestion 1:markdown How do I add multiple empty lines?
We know that the markdown paragraph is formed by a blank line before and after, the artificial addition of a number of empty rows is markdown syntax automatically ignore only one empty line, this is more humane, because there is no need to manually delete some extra empty line. However, there are two paragraphs between the need for multiple empty lines, such as the above to give some puzzles, the answer is generally placed at the bottom, the middle of the need for most of the white, This is what you need to do with HTML wrapping tags (previously mentioned markdown syntax is compatible with HTML): that is, to insert a label or label where a blank line is required <br />
<p>
.
If you have any other questions, you can leave a message below, I will put all the questions we have to organize here.
Markdown Basic Syntax description