Markdown Grammar Learning (github/git.oschina.net readme.md writing standard)

Source: Internet
Author: User

At night in the Update Git.oschina.net project, suddenly want to know the source of the readme.md suffix, and then searched, found that readme.md used a small markup language markdown syntax, so simple to see a, special reproduced as follows, for the next reference convenient (http ://blog.csdn.net/kaitiren/article/details/38513715 also good). The Chinese reference manual can be consulted http://wowubuntu.com/markdown/index.html

Markdown's goal is to achieve "easy to read and write", compatible with HTML.

However, the Markdown format syntax between HTML chunk tags will not be processed. For example, you can use the Markdown-style * accent * in HTML chunks without effect. In other words, Markdown and HTML tags cannot be nested using

Title

Markdown supports two headings of syntax, Class Setext, and Class ATX form.

The class Setext form is in the form of a bottom line, using = (highest-order headings) and - (second-order headings), for example:

This is an H1=============This is an H2-------------

any number of = and - all can have effect .

The class Atx form is inserted at the beginning of the line 1 to 6 # , corresponding to the title 1 to 6 order, for example:

# 这是 H1## 这是 H2###### 这是 H6

You can selectively "close" the title of the ATX style, which is purely aesthetic, and if you feel comfortable, you can add it at the end # of the line, and the number of lines at the end is # not the same as the beginning (the number of wells in the beginning determines the order of the title):

# 这是 H1 ### 这是 H2 ##### 这是 H3 ######

List

Markdown supports both sequential and unordered lists.

Unordered lists use asterisks, plus signs, or minus signs as list markers:

*   Red*   Green*   Blue

Equivalent to:

+   Red+   Green+   Blue

is also equivalent to:

-   Red-   Green-   Blue

The sequence table uses numbers followed by a period:

1.  Bird2.  McHale3.  Parish

It is important that the number you use on the list tag does not affect the output HTML result, which is generated by the HTML tag:

<ol><li>Bird</li><li>McHale</li><li>Parish</li></ol>

If your list tag is written as:

1.  Bird1.  McHale1.  Parish

or even:

3. Bird1. McHale8. Parish

code block

Program-related writing or tag language source code will usually have a well-written code block, usually these blocks we do not want it to the general paragraph file layout, but as the original appearance, Markdown will use <pre> and <code> tags to the code block package up.

To create a code block in Markdown is simple, simply indent 4 spaces or 1 tab characters, for example, the following input:

这是一个普通段落:    这是一个代码区块。

Markdown will be converted into:

<p>这是一个普通段落:</p><pre><code>这是一个代码区块。</code></pre>

Divider Line

You can create a divider line with more than three asterisks, minus signs, and bottom lines in a row, and there's nothing else in the line. You can also insert a space between an asterisk or a minus sign. Separate lines can be created for each of the following types of notation:

* * *********- - ----------------------------------------

Image

Obviously, it is difficult to design a "natural" syntax to insert a picture in a plain text application.

Markdown uses a syntax similar to a link to mark a picture, and also allows two styles: inline and reference.

The inline image syntax looks like this:

![Alt text](/path/to/img.jpg)![Alt text](/path/to/img.jpg "Optional title")
    • An exclamation of!
    • followed by a square bracket, where the alternative text of the slice
    • Then an ordinary bracket, inside the URL of the film, and finally can be enclosed in quotation marks and add the optional ' title ' text.

The reference image syntax looks like this:

![Alt text][id][id]是图片参考的名称,图片参考的定义方式则和连结参考一样:
[id]: url/to/image  "Optional title attribute"

So far, Markdown has not been able to specify the width of the picture, and if you need it, you can use the normal label.

============================================================================= scripts such as: effects such as: script content as follows: [HTML]View PlainCopy
  1. AlarmClock
  2. ==
  3. AlarmClock
  4. -
  5. AlarmClock
  6. *single asterisks*
  7. **double asterisks**
  8. Tripple asterisks***
  9. - - -
  10. * * *
  11. This is a general paragraph:
  12. protected void OnCreate (Bundle savedinstancestate) {
  13. Super.oncreate (savedinstancestate);
  14. Setcontentview (R.layout.activity_main);
  15. Iniview ();
  16. }
  17. ! [GitHub] (/res/drawable-hdpi/ic_launcher.png)

Markdown Grammar Learning (github/git.oschina.net readme.md Writing specification) (ext.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.