markdown grammar learning

markdown grammar learning

block element

1. Paragraph title

1 to 6 # + spaces + titles, corresponding to levels 1 to 6 of titles, for example:

# Primary title  
## Secondary title  
......  
###### Six level title

2. Block reference

2.1. Basic usage

  • First break the line, and then add >, for example:
>first line  
>Second line

effect:

first line
Second line

  • Markdown also allows you to be lazy and just add > at the beginning of the first line of the whole paragraph, for example:
>Third line  
Fourth line

effect:

Third line
Fourth line

2.2. Reference nesting

Block references can be nested as long as different numbers of >:

> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.

effect:

This is the first level of quoting.

This is nested blockquote.

Back to the first level.

2.3. Contains additional syntax

Other Markdown syntax can also be used in the referenced block, including title, list, code block, etc., for example:

> 1.   This is the first row of list items.
> 2.   This is the second row of list items.
> 
> Give some example codes:
> 
>     return shell_exec("echo $input | $markdown_script");

effect:

  1. This is the first row of list items.
  2. This is the second row of list items.

Give some example codes:

return shell_exec("echo $input | $markdown_script");

3. Paragraph wrap

Press in more than two spaces at the insertion, and then enter.
For example:

First line (followed by two spaces)+(enter)  
Second line

effect:

First line (followed by two spaces + Enter)
Second line

4. List

4.1. Unordered list

Unordered lists use *, + or - as list markers:

*   Red
*   Green
*   Blue  

or:
+   Tom
+   Jerry
+   Jack  

or:
-   Apple
-   Orange
-   Banana

effect:

  • Red
  • Green
  • Blue

Or:

  • Tom
  • Jerry
  • Jack

Or:

  • Apple
  • Orange
  • Banana

4.2. Ordered list

If there is a sequence table, use numbers followed by an English period:

1.  Bird
2.  McHale
3.  Parish

effect:

  1. Bird
  2. McHale
  3. Parish

4.3. The list contains multiple paragraphs

List items can contain multiple paragraphs. The paragraphs under each item must be indented with 4 spaces or 1 tab:

1.  This is a list item with two paragraphs. Lorem ipsum dolor
    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    mi posuere lectus.

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    sit amet velit.

2.  Suspendisse id sem consectetuer libero luctus adipiscing.

effect:

  1. This is a list item with two paragraphs. Lorem ipsum dolor
    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    mi posuere lectus.

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    sit amet velit.

  2. Suspendisse id sem consectetuer libero luctus adipiscing.

4.4. List nesting

List nesting simply adds four spaces in front of the options in the sub list:

1. Item 1:
    - The first element of the first item nest
    - The second element nested in the first item
2. Item 2:
    - The first element of the second nested item
    - The second nested element of the second item

effect:

  1. Item 1:
    • The first element of the first item nest
    • The second element nested in the first item
  2. Item 2:
    • The first element of the second nested item
    • The second nested element of the second item

4.5. Add reference to list

If you want to put a reference within a list item, then > needs to be indented:

*   A list item with a blockquote:

    > This is a blockquote
    > inside a list item.

effect:

  • A list item with a blockquote:

    This is a blockquote
    inside a list item.

4.6. Add code block to list

If you want to put a code block, the block needs to be indented twice, that is, 8 spaces or 2 tabs:

*   A list item contains a list block:

        <The code is written here>

effect:

  • A list item contains a list block:

    <The code is written here>
    

Or:

*   A list item contains a list block:  

    ```
    <The code is written here>
    ```

effect:

  • A list item contains a list block:

    <The code is written here>
    

4.7. . Escape

Of course, the list of items is likely to be generated accidentally. It is written as follows:

1986. What a great season.

In other words, there is a number period blank at the beginning of the line. To avoid this situation, you can add a backslash before the period.

1986\. What a great season.

effect:

1986. What a great season.

5. Code block

5.1. Spaces or tabs

To create code blocks in Markdown, it's easy to simply indent 4 spaces or 1 Tab (Tab key), for example:

This is an ordinary paragraph:

    This is a code block.

effect:

This is an ordinary paragraph:

This is a code block.

5.2. ``` Mark code block

You can also use ` ` ` to wrap a piece of code and specify a language (or not):

```javascript
$(document).ready(function () {
    alert('RUNOOB');
});
```

effect:

$(document).ready(function () {
    alert('RUNOOB');
});

5.3. In line code

  1. If you want to mark a small piece of inline code, you can wrap it in backquotes, such as:

     Use the `printf()` function.
    

    effect:

    Use the printf() function.

  2. If you want to insert backquotes into inline code, you can open and end inline code with multiple backquotes:

     ``There is a literal backtick (`) here.``
    

    effect:

    There is a literal backtick (`) here.

  3. A blank space can be placed at the beginning and end of the in-line code, one after the beginning and one before the end, so that backquotes can be inserted at the beginning of the in-line code, such as:

    A single backtick in a code span: `` ` ``
    
    A backtick-delimited string in a code span: `` `foo` ``
    

    effect:

    A single backtick in a code span: `

    A backtick-delimited string in a code span: `foo`

6. Dividing line

You can use more than three asterisks, minus signs and bottom lines in a line to create a separation line. There can be nothing else in the line. You can also insert a space between the asterisk or minus sign. You can create separation lines in each of the following ways:

* * *

***

*****

- - -

---------------------------------------

effect:

embedded content

7. Hyperlinks

7.1. Inline

Format: [link name] (link address) or [link name] (link address "title"), for example:

This is an [example link](www.baidu.com).
This is an [example link with title](www.baidu.com "baidu").

effect:

This is an example link.
This is an example link with title.

7.2. Reference formula

Format: [link name] [id], for example:

I get 10 times more traffic from [Google] [1] than from
[Yahoo] [2] or [MSN] [3].

[1]: http://google.com/        "Google"
[2]: http://search.yahoo.com/  "Yahoo Search"
[3]: http://search.msn.com/    "MSN Search"

Or:

I get 10 times more traffic from [Google][] than from
[Yahoo][] or [MSN][].

[google]: http://google.com/        "Google"
[yahoo]:  http://search.yahoo.com/  "Yahoo Search"
[msn]:    http://search.msn.com/    "MSN Search"

Effect (the first csdn does not take effect, and both Youdao cloud notes take effect):

I get 10 times more traffic from Google than from
Yahoo or MSN.

7.3. Automatic link

Wrap the link address with < and > and the link text will be the same as the link address, for example:

<http://www.baidu.com>

effect: http://www.baidu.com

8. Picture link

8.1. Inline

Format:! [alternative text of picture] (website address of picture) or! [alternative text of the picture] (the website address of the picture is "title"), for example:

![Alt text](https://img-blog.csdnimg.cn/img_convert/4a241182f0fc299367dd713a11ca9c87.png)

![Alt text](https://img-blog.csdnimg.cn/img_convert/b34b23032902a3f81cf349300c976f84.png "Optional title")
    
![not bother to ask questions or listen to what 's said](https://img-blog.csdnimg.cn/img_convert/69c8bb3c97e0c29d05255d2c920431e0.png)

effect:


8.2. Reference formula

![Alt text][id]

[id]: url/to/image  "Optional title attribute"

effect:

9. Emphasize

9.1. typeface

Markdown uses an asterisk * and a bottom line_ A symbol used as a marker to emphasize words

*Italic text*
_Italic text_
**Bold text**
__Bold text__
***Bold italic text***
___Bold italic text___

effect:

Italic text
Italic text
Bold text
Bold text
Bold italic text
Bold italic text

9.2. Delete line

Just add two wavy lines ~ ~ at both ends of the text, such as:

~~BAIDU.COM~~

Effect: Baidu COM

9.3. Underline

Underline can be realized through the < U > tag of HTML, such as:

<u>Underlined text</u>

Effect: underlined text

10. Forms

10.1. Basic grammar

Markdown makes tables, uses | to separate different cells, and uses - to separate headers and other rows, such as:

|  Header   | Header  |
|  ----  | ----  |
| Cell  | Cell |
| Cell  | Cell |

effect:

HeaderHeader
CellCell
CellCell

10.2. Alignment (Youdao cloud notes do not take effect)

-: set the right alignment of content and title bar.
: - align the content and title bar to the left.
: -: center the content and title block.

Example:

| Align left | Right align | Center alignment |
| :-----| ----: | :----: |
| Cell | Cell | Cell |
| Cell | Cell | Cell |

effect:

Align leftRight alignCenter alignment
CellCellCell
CellCellCell

other

11. Backslash

Markdown can use backslash to insert some symbols with other meanings in grammar, such as:

\*literal asterisks\*

Effect: * literal asterisks*

Markdown supports the following symbols to be preceded by backslashes to help insert ordinary symbols:

\   Backslash
`   backquote 
*   asterisk
_   baseline
{}  Curly bracket
[]  square brackets
()  brackets
#   Well size
+   plus
-   minus sign
.   English period
!   Exclamation mark

12. Anchor point

csdn does not take effect. Youdao cloud notes take effect

<a href="# markdown grammar learning "> jump to the title</a>

effect:
Jump to title

13. Navigation

Use [TOC] (Youdao cloud notes), @ [TOC] (write custom directory title here) (csdn) where navigation is needed

Keywords: markdown

Added by typo on Fri, 11 Feb 2022 06:12:36 +0200