Markdown syntax explanation!

brief introduction

Markdown has two meanings: one is a lightweight markup language with plain text syntax format; The second is to edit and parse the markdown syntax to show the final text typesetting effect of the client. Markdown makes the text layout standardized and can be easily converted to HTML or other formats. Let you focus on the text content without wasting time on text typesetting.

title

Syntax:#

  • markdown:

    # Heading level 1
    ## Heading level 2
    ### Heading level 3
    #### Heading level 4
    ##### Heading level 5
    ###### Heading level 6

paragraph

Syntax: empty lines are divided to form paragraphs

  • markdown:

    Paragraph 1.
    
    Paragraph 2.
  • Actual effect:

    Paragraph 1.

Paragraph 2.

Line feed

Syntax: 2 spaces + enter for normal paragraph line feed; Use < br > to wrap lines in the table.

  • markdown:

    This is the first line.  
    And this is the second line.
    
    This is the first line.<br>
    And this is the second line.
  • Actual effect:
    This is the first line.
    And this is the second line.

    This is the first line.
    And this is the second line.

Italics

Syntax: use * or_ Include italics

  • markdown:

    Italicized text is the *cat's meow*.  
    Italicized text is the _cat's meow_.
  • Actual effect:

    Italicized text is the cat's meow.

    Italicized text is the _cat's meow_.

bold

Use * * or__ Include bold content;

  • markdown:

    I just love **bold text**.
    I just love __bold text__.
  • Actual effect:

    I just love bold text.

    I just love __bold text__.

Bold + Italic

Use * * * or___ Include content

  • markdown:

    This text is ***really important***.
    This text is ___really important___.
    This text is __*really important*__.
    This text is **_really important_**.
    • Actual effect:
      This text is really important.
      This text is ___really important___.
      This text is __really important__.
      This text is really important.

Paragraph reference

  1. Add > at the beginning of the paragraph

    • Markdown notation
      > Dorothy followed her through many of the beautiful rooms in her castle.
    • Actual effect:

      Dorothy followed her through many of the beautiful rooms in her castle.

  2. Multiple paragraph references

    • Markdown notation

      > 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.
    • Actual effect:

      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.

  3. Paragraph nested reference

    • Markdown notation

      > 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.
    • Actual effect:

      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.

  4. References are used with other elements

    • Markdown notation

      > **The quarterly results look great!**
      >
      > - Revenue was off the chart.
      > - Profits were higher than ever.
      >
      >  *Everything* is going according to **plan**.
    • Actual effect:

      The quarterly results look great!

      • Revenue was off the chart.
      • Profits were higher than ever.

        Everything is going according to plan.

list

  1. Ordered list

    • Markdown notation

      1. First item
      2. Second item
      3. Third item
      4. Fourth item
    • Actual effect: (because the sequence of 1, 2 and 3 should be displayed below the indentation)

      1. First item
      2. Second item
      3. Third item
      4. Fourth item
  2. Unordered list (-, +, * implemented with these three symbols)

    • Markdown (only - description below)

      - First item
      - Second item
      - Third item
          - Indented item
          - Indented item
      - Fourth item
    • Actual effect:

      • First item
      • Second item
      • Third item

        • Indented item
        • Indented item
      • Fourth item
  3. Insert paragraph in list

    • Markdown notation

      *   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.
    • Actual effect:

      • 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.
  4. Inserts a block reference into the list

    • Markdown notation

      *   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.
    • Actual effect:

      • 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.

Code block

  1. Use ` to include a word or phrase

    • Markdown notation

      At the command prompt, type `nano`.
    • Actual effect:

      At the command prompt, type nano.

  2. Include code blocks with

    • Markdown notation

      <head>
          <title>Test</title>
      </head>
    • Actual effect:

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

Split line

Syntax: * * *, ----___

  • Markdown notation

    ***
    ---
    ___
  • Actual effect:

    _

link

  1. Format: [link name] (URL)

    • Markdown notation

      My favorite search engine is [Duck Duck Go](https://duckduckgo.com).
    • Actual effect:

      My favorite search engine is Duck Duck Go.

  2. Format: [link name] (URL "Title") add a link title (displayed when the mouse hovers)

    • Markdown notation

      My favorite search engine is [Duck Duck Go](https://duckduckgo.com "The best search engine for privacy").
    • Actual effect:

      My favorite search engine is Duck Duck Go.

  3. Links are used with other elements

    • Markdown notation

      I love supporting **[EFF](https://eff.org)**.
      This is the *[Markdown Guide](https://www.markdownguide.org)*.
    • Actual effect:

      I love supporting EFF.

      This is the Markdown Guide.

  4. Link nesting

    • Markdown notation

      [![Baidu home page](www.baidu.com/img/baidu_jgylogo3.gif "Baidu home page")](www.baidu.com)
    • Actual effect:

  5. Original text plus link optimization

    • Markdown notation

      In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends
      of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to
      eat: it was a [hobbit-hole](https://en.wikipedia.org/wiki/Hobbit#Lifestyle "Hobbit lifestyles"), and that means comfort.
      
      The above writing method and the following writing method have the same display effect, but inserting the link in the original text is very difficult to read. You can modify it in the following way to facilitate reading:
      
      In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends
      of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to
      eat: it was a [hobbit-hole][1], and that means comfort.  
      
      [1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> "Hobbit lifestyles"
    • Actual effect:

      In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends
      of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to
      eat: it was a hobbit-hole, and that means comfort.

    [1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> "Hobbit lifestyles"

URL variable link

Syntax: < URL >

picture

Syntax:! [picture name] (URL)

  • Markdown notation

    1.  Open the file containing the Linux mascot.
    2.  Marvel at its beauty.
    
    ![Tux, the Linux mascot](http://www.baidu.com/img/baidu_jgylogo3.gif)
    
    3.  Close the file.
  • Actual effect:

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

    1. Close the file.

Special character back reference

Syntax: \ the following special characters can be backreferenced with a backslash

  • Markdown notation

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

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

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

  • Special characters that can be processed

    \`*-{}[]()#+-ยท! 

HTML compatible

HTML can be directly inserted into markdown. The parsing library is not open by default. You need to refer to the corresponding library documents. Markdown it sets html: true

1. Add HTML table to Markdown file:
  • markdown:

    This is an ordinary paragraph.
    <table>
    <tr>
        <td>Foo</td>
    </tr>
    </table>
    This is another ordinary paragraph.
  • Actual effect

    This is an ordinary paragraph.

    Foo

    This is another ordinary paragraph.

2. Markdown embedded video
  • markdown:

    1. Insert video
    <video src="Video link" width="320" height="180" controls="controls"></video> 
  • Actual effect:

    < video SRC = "video connection" width = "320" height = "180" controls = "controls" > < / video >

form

Syntax: use | to separate different cells, and - to separate headers and other rows.

  • markdown:

    | Align left | Right align | Center alignment |
    | :-----| ----: | :----: |
    | Cell | Cell | Cell |
    | Cell | Cell | Cell |
      
    -: Set the right alignment of content and title bar.
    :- Set the left alignment of content and title bar.
    :-: Center the content and title block.
  • Actual effect:

    |Align left | align right | align Center|
    | :-----| ----: | :----: |
    |Cell | cell | cell|
    |Cell | cell | cell|

Other reference links

Tags: markdown

Posted on Tue, 30 Nov 2021 19:33:29 -0500 by DarkEden