< < access Wow! Ubuntu

NOTE: This is Simplelified Chinese Edition Document of Markdown Syntax. If you are seeking for English Edition Document. Please refer to Markdown: Syntax.

Disclaimer: This document is fork from the traditional Chinese version, based on which the traditional Chinese version has been transferred to the simplified Chinese version, and the appropriate polish has been made. This document is written in Markdown syntax, and you can view its source file here. “The original file in traditional Chinese can be viewed here.” –By @riku

Note: this project is hosted on GitCafe, please help to improve this project by “derive” and “merge request”.

*** AD: This website is hosted by DigitalOcean.com VPS service provider with SSD, click here to buy, you can get 10USD free discount!

Markdown Syntax (Simplified Chinese Version)/(Click here for quick Start)

  • An overview of the
    • objective
    • Compatible with HTML
    • Automatic conversion of special characters
  • Block element
    • Paragraphs and line breaks
    • The title
    • Block reference
    • The list of
    • The code block
    • Dividing line
  • Segment element
    • link
    • Emphasis on
    • code
    • The picture
  • other
    • The backslash
    • Automatic link
  • Thank you
  • Markdown free editor

An overview of the

objective

Markdown aims to be “easy to read and easy to write”.

Readability, however, is Paramount. A document written in Markdown format should be able to be published in plain text and not look like it is made up of many tags or formatting instructions. Markdown syntax is influenced by some of the existing text-to-HTML formats, including Setext, ATX, Textile, reStructuredText, Grutatext and EtText, but the biggest inspiration is actually the format of plain text E-mail.

In short, Markdown’s syntax is made up entirely of symbols that have been carefully chosen to show what they do. For example, asterisks along the sides of text make it look like * emphasis *. Markdown’s list looks, well, like a list. Markdown’s block reference really looks like quoting a paragraph of text, just like you’ve seen in email.

Compatible with HTML

The goal of Markdown syntax is to become a written language suitable for the web.

Markdown is not trying to replace HTML, or even come close to it, and it has a very small variety of syntax that only corresponds to a fraction of HTML tags. Markdown is not conceived to make HTML documents easier to write. In my opinion, HTML is already easy to write. The idea behind Markdown is to make documents easier to read, write and edit. HTML is a publishing format and Markdown is a writing format. As such, Markdown’s formatting syntax covers only as much as plain text can.

Tags that are not covered by Markdown can be written in HTML directly within the document. You don’t have to call it HTML or Markdown; Just add the label.

Only certain HTML block elements — such as

,

, 

tags -- must be separated from the rest by a blank line, and their opening and closing tags must not be indented with tabs or Spaces. Markdown's generator is smart enough not to add unnecessary

tags to HTML block tags.

,

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

This is an ordinary paragraph. <table> <tr> < TD >Foo</td> </tr> </table> This is another normal paragraph.Copy the code

Note that Markdown formatting syntax between HTML block tags will not be processed. For example, if you use Markdown style * emphasis * in HTML blocks, it will have no effect.

HTML section (inline) tags such as , , can be used freely in Markdown paragraphs, lists, or headings. You can even use HTML tags instead of Markdown if you like. For example: If you prefer HTML or tags, you can use those tags directly without the link or image tag syntax provided by Markdown.

Unlike between HTML block tags, Markdown syntax is valid between HTML section tags.

Automatic conversion of special characters

In HTML files, there are two characters that require special handling: < and &. The < symbol is used for the start tag, and the ampersand symbol is used to mark HTML entities. If you only want to display prototypes of these characters, you must use entity forms such as < and &.

The ampersand character is especially torturing for web writers. If you type “AT&T,” you have to write “AT&T.” The ampersand character in the url is also converted. Say you want to link to:

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

You must write the url conversion as:

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

To put it in the href attribute of the link tag. Needless to say, this is easily overlooked, and is probably the largest number of errors that HTML standards have ever detected.

Markdown allows you to write characters naturally, and takes care of converting them. If the ampersand character you use is part of the HTML character entity, it will remain as it is, otherwise it will be converted to ampersand; .

So if you want to insert a copyright © in your document, you can write:

©
Copy the code

Markdown will leave it there. And if you write:

AT&T
Copy the code

Markdown will change it to:

AT&T
Copy the code

A similar situation applies to < because Markdown is HTML-compatible. If you use < as a delimiter for an HTML tag, Markdown does nothing to convert it. However, if you write:

4 < 5
Copy the code

Markdown will convert it to:

4 < 5
Copy the code

Note, however, that the < and & symbols are always converted to HTML entities within code, whether inline or block. This feature allows you to easily write HTML code in Markdown (in contrast to HTML, To write HTML code in an HTML file, you need to convert all < and & to HTML entities.


Block element

Paragraphs and line breaks

A Markdown paragraph is made up of one or more consecutive lines of text preceded by more than one blank line (a blank line is defined as a blank line if it appears empty on display. For example, if a line contains only Spaces and tabs, it is considered empty. Normal paragraphs should not be indented with Spaces or tabs.

The sentence “consists of one or more consecutive lines of text” implies that Markdown allows forced line breaks within paragraphs, This feature is unlike most other text-to-HTML formats (including the “Convert Line Breaks” option for Movable Type), which Convert every Line break to a

tag.

If you really want to rely on Markdown to insert

tags, press two or more Spaces at the insertion point and then enter.

Sure, it takes a little extra work (extra space) to produce

, but the simple “every newline is converted to

” approach doesn’t work well in Markdown, where emailing block references and multi-paragraph lists are formatted using newlines. Not only is it easier to use, it’s also easier to read.

The title

Markdown supports two header syntax, seText-like and ATX-like forms.

The setext-like form is in the form of the bottom line, using = (highest-order heading) and – (second-order heading), for example:

This is an H1
=============

This is an H2
-------------
Copy the code

Any number of = and – will work.

The ATX-like form inserts 1 to 6 # at the beginning of the line, corresponding to order 1 to 6 of the title, for example:

# this is H1 ## this is H2 ###### this is H6Copy the code

You can optionally “close” atX-like headings. This is purely aesthetic, and if you feel comfortable with it, you can add # at the end of the line, and the number of # at the end of the line doesn’t have to be the same as the number of # at the beginning (the number of hashtags at the beginning of the line determines the order of the heading) :

# This is H1 ### this is H2 ##### and this is H3 ######Copy the code

Blocks reference Blockquotes

Markdown marks a block reference using a reference similar to the > used in email. If you’re familiar with the introductory part of an email, you know how to create a block reference in a Markdown file that looks like you broke the line yourself and then preceded each line with > :

> This is a blockquote 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. Suspendisse
> id sem consectetuer libero luctus adipiscing.
Copy the code

Markdown also allows you to be lazy and just add > at the beginning of the first line of the entire paragraph:

> This is a blockquote 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. Suspendisse
id sem consectetuer libero luctus adipiscing.
Copy the code

Block references can be nested (e.g., references within references) by adding a different number of > depending on the level:

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

Other Markdown syntax can also be used within referenced blocks, including headings, lists, code blocks, and so on:

> ## This is a headline. > > 1. This is the first list item. > 2. This is the second row entry. > > give some example code: > > return shell_exec (" echo $input | $markdown_script ");Copy the code

Any decent text editor can easily set up email references. In BBEdit, for example, you can select text and then add a reference level from the menu.

The list of

Markdown supports both ordered and unordered lists.

Unordered lists are marked with an asterisk, plus, or minus sign:

*   Red
*   Green
*   Blue
Copy the code

Is equal to:

+   Red
+   Green
+   Blue
Copy the code

Also equivalent to:

-   Red
-   Green
-   Blue
Copy the code

Ordered lists use numbers followed by an English period:

1.  Bird
2.  McHale
3.  Parish
Copy the code

It is important to note that the number you use on the list tag does not affect the HTML output. The list above produces the HTML tag:

<ol>
<li>Bird</li>
<li>McHale</li>
<li>Parish</li>
</ol>
Copy the code

If your list tag is written as:

1.  Bird
1.  McHale
1.  Parish
Copy the code

Or even:

3. Bird
1. McHale
8. Parish
Copy the code

You’ll get exactly the same HTML output. The point is, you can make the list number in the Markdown file the same as the output, or if you’re lazy, you don’t care about the correct number at all.

If you’re using lazy writing, it’s best to start the first project with 1. Since Markdown may support the start attribute for ordered lists in the future.

List item tags are usually placed at the far left, but can be indented up to three Spaces, and must be followed by at least one space or TAB.

To make a list look nice, you can sort things out with fixed indentation:

*   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.
    Suspendisse id sem consectetuer libero luctus adipiscing.
Copy the code

But if you’re lazy, that’s fine:

*   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.
Suspendisse id sem consectetuer libero luctus adipiscing.
Copy the code

If the list items are separated by blank lines, Markdown will wrap the item contents in

tags when the HTML is output, for example:

*   Bird
*   Magic
Copy the code

Will be converted to:

<ul>
<li>Bird</li>
<li>Magic</li>
</ul>
Copy the code

But this:

*   Bird

*   Magic
Copy the code

Will be converted to:

<ul>
<li><p>Bird</p></li>
<li><p>Magic</p></li>
</ul>
Copy the code

List items can contain multiple paragraphs, each paragraph must be indented 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.
Copy the code

If you indent each line, it looks a lot better. Again, if you’re lazy, Markdown also allows:

* This is a list item with two paragraphs. This is the second paragraph in the list item. You're only required to indent  the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Another item in the same list.Copy the code

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

*   A list item with a blockquote:

    > This is a blockquote
    > inside a list item.
Copy the code

To place a code block, the block needs to be indented twice, which is 8 Spaces or 2 tabs:

* A list item contains a list block: < code written here >Copy the code

Of course, a list of items can be created by accident, like this:

1986. What a great season.
Copy the code

In other words, a number – period – blank space at the beginning of the line. To avoid this, you can put a backslash before the period.

1986\. What a great season.
Copy the code

The code block

The writing or tag language source code associated with the program will usually have blocks of code that are already formatted. Usually these blocks are not expected to be formatted like a normal paragraph file, but rather displayed as they are. Markdown will use

 and  tags to enclose the blocks.

Creating code blocks in Markdown is as simple as indenting 4 Spaces or 1 TAB, for example:

This is a normal paragraph: this is a code block.Copy the code

Markdown will convert to:

<p> This is a normal paragraph: </p> <pre><code> This is a code block. </code></pre>Copy the code

The one-order indentation of each line (4 Spaces or 1 TAB) is removed, for example:

Here is an example of AppleScript:

    tell application "Foo"
        beep
    end tell
Copy the code

Will be converted to:

<p>Here is an example of AppleScript:</p>

<pre><code>tell application "Foo"
    beep
end tell
</code></pre>
Copy the code

A block of code continues until the line (or the end of the file) is not indented.

In the code block, the &, <, and > are automatically converted to HTML entities. This makes it very easy to use Markdown to insert the sample HTML source code. Just copy it, indent it, and then Markdown will take care of the rest.

    <div class="footer">
        © 2004 Foo Corporation
    </div>
Copy the code

Will be converted to:

<pre><code><div class="footer">
    &copy; 2004 Foo Corporation
</div>
</code></pre>
Copy the code

In code blocks, normal Markdown syntax is not converted, and asterisks, for example, are just asterisks, which means you can easily write Markdown syntax related files in Markdown syntax.

Dividing line

You can create a line with more than three asterisks, minus signs, and bottom lines on a single line. You can also insert Spaces between asterisks and minus signs. Each of the following ways can create a dividing line:

* * * * * * * * * * * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --Copy the code

Segment element

Markdown supports two forms of link syntax: inline and reference.

Either way, the link text is marked with square brackets.

To create an inline link, simply place the parentheses after the square brackets and insert the url link. If you also want the title text of the link, put double quotation marks around the title text after the url, for example:

This is [an example](http://example.com/ "Title") inline link.

[This link](http://example.net/) has no title attribute.
Copy the code

Produce:

<p>This is <a href="http://example.com/" title="Title">
an example</a> inline link.</p>

<p><a href="http://example.net/">This link</a> has no
title attribute.</p>
Copy the code

If you want to link to a resource from the same host, you can use a relative path:

See my [About](/about/) page for details.
Copy the code

A reference link is one in which the brackets of the link text are followed by another square bracket, and the second square bracket is filled with a mark that identifies the link:

This is [an example][id] reference-style link.
Copy the code

You can optionally add a space between the brackets:

This is [an example] [id] reference-style link.
Copy the code

Then, at any point in the file, you can define what the tag links to:

[id]: http://example.com/  "Optional Title Here"
Copy the code

The link content definition is of the form:

  • Square brackets (optionally preceded by up to three Spaces for indentation) enter the link text inside
  • And then a colon
  • Followed by more than one space or TAB character
  • Then the url of the link
  • Optionally enclose the title content, either in single, double, or parentheses

The following three links are defined the same:

[foo]: http://example.com/  "Optional Title Here"
[foo]: http://example.com/  'Optional Title Here'
[foo]: http://example.com/  (Optional Title Here)
Copy the code

Note: There is a known problem with markdown.pl 1.0.1 that ignores single quoted link titles.

Link urls can also be wrapped in Angle brackets:

[id]: <http://example.com/>  "Optional Title Here"
Copy the code

You can also put the title property on the next line, or indent it if the url is too long:

[id]: http://example.com/longish/path/to/resource/here
    "Optional Title Here"
Copy the code

Url definitions are only used to generate links and do not appear directly in files.

Link discrimination tags can have letters, numbers, white space, and punctuation, but are not case sensitive, so the following two links are the same:

[link text][a]
[link text][A]
Copy the code

The implicit link tag allows you to omit the specified link tag. In this case, the link tag is treated as the same as the link text. To use the implicit link tag, put an empty square bracket after the link text.

[Google][]
Copy the code

Then define the link content:

[Google]: http://google.com/
Copy the code

Because link text may contain white space, this simplified tag may contain more than one word:

Visit [Daring Fireball][] for more information.
Copy the code

Then we define the link:

[Daring Fireball]: http://daringfireball.net/
Copy the code

The link definition can be placed anywhere in the document. I prefer to place it directly after the paragraph where the link appears, or you can place it at the very end of the document, like a comment.

Here is an example of a reference link:

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"
Copy the code

If you use the link name instead:

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"
Copy the code

Either way, the following HTML is generated.

<p>I get 10 times more traffic from <a href="http://google.com/"
title="Google">Google</a> than from
<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
Copy the code

Here is the Markdown file with the same paragraph in inline form, provided for comparison:

I get 10 times more traffic from [Google](http://google.com/ "Google") than from [Yahoo](http://search.yahoo.com/ "Yahoo  Search") or [MSN](http://search.msn.com/ "MSN Search").Copy the code

The point of reference links is not that they are easier to write, but that they are easier to read. Compare this to the example above. The reference text itself is only 81 characters long, but the inline text is 176 characters long. There are more tags than text.

Using Markdown’s referential links makes the document more like the end result of the browser, allowing you to move some of the markup related metadata out of the paragraph text so you can add links without breaking the reading feel of the article.

Emphasis on

Markdown uses an asterisk (*) and a bottom line (_) as symbols for emphasizing words. Words surrounded by * or _ are converted to tags, and words surrounded by two * or _ are converted to , for example:

*single asterisks*

_single underscores_

**double asterisks**

__double underscores__
Copy the code

Will be converted to:

<em>single asterisks</em>

<em>single underscores</em>

<strong>double asterisks</strong>

<strong>double underscores</strong>
Copy the code

You can use any style you like, the only limitation is that you end the tag with the same symbol you open it with.

Emphasis can also be inserted directly into the text:

un*frigging*believable
Copy the code

But if you have space on both sides of the * and _, they will be treated as normal symbols.

To insert plain asterisks or underlines directly before and after text, you can use backslashes:

\*this text is surrounded by literal asterisks\*
Copy the code

code

If you want to mark a small piece of in-line code, you can surround it with backquotes (‘), for example:

Use the `printf()` function.
Copy the code

Produce:

<p>Use the <code>printf()</code> function.</p>
Copy the code

If you want to insert backquotes inside a code section, you can open and close a code section with multiple backquotes:

``There is a literal backtick (`) here.``
Copy the code

This syntax produces:

<p><code>There is a literal backtick (`) here.</code></p>
Copy the code

You can put a blank space at the beginning and end of a code section, one after the beginning and one before the end, so that you can insert backquotes at the beginning of the section:

A single backtick in a code span: `` ` ``

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

Produce:

<p>A single backtick in a code span: <code>`</code></p>

<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
Copy the code

Within the code section, both ampersand and Angle brackets are automatically converted to HTML entities. This makes it easy to insert the HTML source code. Markdown puts the following:

Please don't use any `<blink>` tags.
Copy the code

To:

<p>Please don't use any <code><blink></code> tags.</p>
Copy the code

You can also write:

'--' is the decimal-encoded equivalent of '--'.Copy the code

To produce:

<p><code>&#8212; </code> is the decimal-encoded equivalent of <code>&mdash; </code>.</p>Copy the code

The picture

Obviously, it is difficult to design a “natural” syntax for inserting images in a text-only application.

Markdown uses a syntax similar to linking to tag images, and also allows for two styles: inline and reference.

Inline image syntax looks like:

! [Alt text](/path/to/img.jpg) ! [Alt text](/path/to/img.jpg "Optional title")Copy the code

The details are as follows:

  • An exclamation point!
  • Then a square bracket is placed inside the image’s substitute text
  • This is followed by a normal parenthesis with the url of the image inside it, and finally enclosed in quotation marks with optional ‘title’ text.

The reference image syntax looks something like this:

! [Alt text][id]Copy the code

“Id” is the name of an image reference, which is defined in the same way as a link reference:

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

So far, Markdown has no way to specify the width and height of an image, but you can use the normal tag if you want.


other

Markdown supports shorter auto-links for web addresses and E-mail addresses, which Markdown automatically converts to links when wrapped in Angle brackets. The text of the link is the same as the link address, for example:

<http://example.com/>
Copy the code

Markdown will become:

<a href="http://example.com/">http://example.com/</a>
Copy the code

Automatic linking of email addresses is similar, except that Markdown first performs a code-conversion process, converting text characters into HTML entities with 16-bit codes. This format can fool some bad email address collectors, such as:

<[email protected]>
Copy the code

Markdown will change to:

<a href="mailto:addre
[email protected]
m">address@exa
mple.com</a>
Copy the code

In the browser, the string (actually [email protected]) becomes a clickable “[email protected]” link.

(This can fool a lot of robots, but it won’t stop them all, but it’s better than nothing. Anyway, publishing your email will eventually lead to advertising mail.

The backslash

Markdown can use backslashes to insert symbols that have other meanings in the syntax. For example, if you want to add asterisks to text for emphasis (but without the tag), you can add backslashes before the asterisks:

\*literal asterisks\*
Copy the code

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

\ Backslash 'backslash * asterisk _ Bottom line {} curly brackets [] square brackets () bracket # hash + plus - minus. English period! Exclamation markCopy the code

Thank you

Thanks to Leafy7382 for help translation, HLB, Randylien for help to run the draft, ethantw Chinese standard format CSS Reset, WM return text error.

Thank you fenprace, ADDV.


Markdown free editor

The Windows platform

  • MarkdownPad
  • MarkPad

Linux platform

  • ReText

Mac

  • Mou

Online editor

  • Markable.in
  • Dillinger.io

Browser plug-in

  • MaDe (Chrome)

Advanced application

  • Sublime Text 2 + MarkdownEditing/Tutorial

*** If you have better Markdown free editor recommendation, please feedback here, thank you!