Use of markdown language

Markdown language is a lightweight markup language that is widely used to write richly formatted documents. The following is the basic usage of Markdown language:

  • Title: Add # before the text you want to set the title. One # is a first-level title, two # is a second-level title, and so on, up to six-level titles.

  • Paragraph format:

    • Line break: Without using line breaks or blank lines, Markdown defaults to two lines of content without line breaks, separated only by spaces. There are two ways to wrap the line, add 2 spaces at the end of the statement or use a blank line.
    • Bold/Italic: Grammar is Italic Grammar: Content ; Bold Grammar: Content ; Italic + Bold Grammar: Content .
    • Dividing line: Method one: *** content; Method two: --- content.
    • Strikethrough: Grammar is content.
    • Underlined: The syntax is <u>content</u>.
  • List:

    • Ordinary list: The syntax is *+space+content. (The symbol * can be replaced by the symbol + or -)
    • Nested lists: When the list needs to be further subdivided, use 4 spaces + + spaces + content syntax. (The symbol can be replaced by the symbol + or -)
    • List with numbers: The syntax is number+.+space+content. The nesting syntax is 4 spaces + numbers + . + spaces + content.

In addition to the above basic usage, the Markdown language also has some advanced usage, including:

  • Quotation: Use the > symbol to quote a piece of text. A one-character space must be left between > and the text.
  • Link: To insert a link just use display text .
  • Picture: To insert a picture, just use the format ![alt text](image url).
  • Markdown itself does not support emoji expressions, but you can use HTML tags or CSS classes to achieve similar effects. For example, you can use it :smile:to represent a smiling expression, or you can use it :heart:to represent a heart shape. For more Emoji expressions, please check the Emoji expression list.

Markdown escape character syntax

To display characters originally used to format a Markdown document, add the backslash character \ in front of the character.

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

The rendering effect is as follows:

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

#Characters that can be escaped

The characters listed below can be escaped using the backslash character.

Character Name
\ backslash
` backtick (see also escaping backticks in code)
* asterisk
_ underscore
{ } curly braces
[ ] brackets
( ) parentheses
# pound sign
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
| pipe (see also escaping pipe in tables)

#Special characters are automatically escaped

In HTML files, there are two characters that require special treatment:  < and  & . < Symbols are used for start tags, & and symbols are used to mark HTML entities. If you just want to use these symbols, you must use the entity form, such as  &lt; and  &amp;.

& In fact, symbols can easily confuse people who write web documents. If you want to type "AT&T", you must write " " AT&amp;T, and you must convert the symbols in the URL  & . If you want to link to:

http://images.google.com/images?num=30&q=larry+bird

You must convert the URL to:

http://images.google.com/images?num=30&amp;q=larry+bird

can be placed  href in the attributes of the link tag. Needless to say, this is easy to forget, and is probably the most common error detected by the HTML standards check.

Markdown allows you to use these symbols directly, and it automatically escapes characters for you. If you use  & the symbol as part of an HTML entity, it will not be converted, but otherwise it will be  &amp;. So if you want to insert a copyright symbol into the file, you can write like this:

&copy;

Markdown will not modify this text, but if you write:

AT&T

Markdown will convert it to:

AT&amp;T

A similar situation will happen with  < symbols, because Markdown supports  inline HTML  . If you use  < symbols as delimiters for HTML tags, Markdown will not do any conversion on it, but if you write:

4 < 5

Markdown will convert it to:

4 &lt; 5

It is important to note that in Markdown's block-level elements and inline elements, the  < and  & two symbols will be automatically converted into HTML entities. This feature allows you to easily write HTML in Markdown. (In HTML syntax, you would manually convert all  < sums  & into HTML entities.)

Markdown embedded HTML tags

For tags outside the scope of Markdown, you can use HTML itself directly in the file. If you want to use HTML, there is no need to mark whether it is HTML or Markdown. You only need to add HTML tags to the Markdown text.

# Row-level inline tags

HTML line-level inline tags such as  <span>, <cite>, and <del> are not restricted and can be used arbitrarily in Markdown paragraphs, lists, or titles. According to personal habits, you can even use HTML tags instead of Markdown format. For example: If you prefer HTML  <a> or  <img> tags, you can use these tags directly instead of the links or image syntax provided by Markdown. It's more convenient to use HTML tags when you need to change the properties of an element, such as assigning a color to text or changing the width of an image.

HTML line-level inline tags are different from block tags. Markdown syntax can be parsed within the scope of inline tags.

This **word** is bold. This <em>word</em> is italic.

The rendering effect is as follows:

This word is bold. This word is italic.

#blocktag _

Block elements, such as  <div>, <table>, <pre>, <p> and other labels, must be preceded and followed by blank lines to facilitate content differentiation. Moreover, the opening and closing tags of these elements cannot be indented using tabs or spaces. Markdown will automatically recognize this block element and avoid adding unnecessary  <p> tags before and after the block label.

For example, add an HTML table to the Markdown file:

This is a regular paragraph.

<table>
    <tr>
        <td>Foo</td>
    </tr>
</table>

This is another regular paragraph.

Please note that Markdown syntax will not be processed in HTML block tags. For example, you cannot use Markdown forms within HTML blocks *强调*.

# HTML Usage Best Practices

For security reasons, not all Markdown applications support adding HTML in Markdown documents. When in doubt, check the manual for the corresponding Markdown application. Some applications support only a subset of HTML tags.

For HTML block-level elements  <div>, <table>, <pre> and  <p>, please use blank lines before and after them to separate them from other content. Try not to use tabs or spaces to indent HTML tags, otherwise the format will be affected.

Markdown syntax cannot be used within HTML block-level tags. For example  <p>italic and **bold**</p> will not work.

Guess you like

Origin blog.csdn.net/Helloorld_1/article/details/132869067