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. Bird
2. McHale
3. 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. Bird
1. McHale
1. Parish
or even:
3. Bird
1. McHale
8. 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
- AlarmClock
- ==
- AlarmClock
- -
- AlarmClock
- *single asterisks*
- **double asterisks**
- Tripple asterisks***
- - - -
- * * *
- This is a general paragraph:
- protected void OnCreate (Bundle savedinstancestate) {
- Super.oncreate (savedinstancestate);
- Setcontentview (R.layout.activity_main);
- Iniview ();
- }
- ! [GitHub] (/res/drawable-hdpi/ic_launcher.png)
Markdown Grammar Learning (github/git.oschina.net readme.md Writing specification) (ext.)