Markdown Introduction and grammar introduction _ Related skills

Source: Internet
Author: User

First, the preface

Before has understood Markdown, but has not actually used, today has tried, feels very cool, recommends to everybody, specially in the writing specification, the interface document and so on aspect very is suitable, because its simple and easy to use also has many people to write the network novel.

Second, introduce

Markdown's goal is to achieve easy to read easy to write, you can directly in the editor to write and save, in addition to its own very good read and write, but also the survival format very good-looking HTML code published in the Internet.

such as links: cloud-dwelling communities, whose writing format is:

[Yun-Habitat community] (http://www.jb51.net/)

Markdown is not trying to replace HTML or even close to it, it has very little syntax, only a small part of the HTML tag. Markdown's idea is not to make HTML documents easier to write. In my opinion, HTML is already very easy to write. Markdown's idea is to make documents easier to read, write, and change. HTML is a published format, and Markdown is a form of writing. In this way, the markdown format syntax covers only the range that plain text can cover.

Iii. Introduction to Grammar

(i) block elements

Paragraphs and line wrapping

A markdown paragraph is made up of one or more contiguous lines of text, with more than one blank line before and after it (the definition of a blank line appears to be empty and is treated as a blank line). For example, if a row contains only spaces and tabs, the row is also treated as a blank line. Normal paragraphs should not be indented with spaces or tabs.

The phrase "composed of one or more contiguous lines of text" actually implies that the markdown allows forced wrapping within a paragraph (press more than two spaces and then enter)

Title

Markdown supports the syntax of two headings, the class Setext and the class [atx][2] form, and we'll just introduce the ATX Form I'm proposing to use. The class Atx form is to insert 1 to 6 # at the beginning of the line, corresponding to the heading 1 through 6, for example:

Copy Code code as follows:

# This is H1
# # This is H2
######, this is H6.

Block reference blockquotes

Markdown Tag block references are references that use > in similar emails, such as:

Copy Code code as follows:

> This is a chunk reference
> This is a chunk reference

The Display form is:

This is a chunk reference
This is a chunk reference

List

Markdown supports a sequence table and unordered list.

An unordered list is marked with an asterisk, plus or minus sign as a list:

Copy Code code as follows:

* Red
* Green
* Blue

A sequence table uses a number followed by an English period:

Copy Code code as follows:

1. Bird
2. McHale
3. Parish

code block

This feature should be our Programmer's favorite feature, building code blocks in Markdown is simple, as long as you simply indent 4 spaces or 1 tabs, and some support code highlighting.

Copy Code code as follows:

It's an ordinary paragraph.

This is a code block.

Separator line

You can create a divider line with more than three asterisks, minus signs, and bottom lines in one line, and nothing else in the line. You can also insert a space between the asterisk or the minus sign. Each of the following ways to create a separator line:

Copy Code code as follows:

* * *

***

*****

- - -

---------------------------------------

(ii) Sector elements

Link

Markdown supports two forms of link syntax: inline and reference

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

Here is only the inline style, and the reference can be accessed in detail at the reference link later in this article.

To create a inline link, just follow the parentheses and insert the URL link immediately after the square bracket, and if you want to add the title of the link, just wrap the title in double quotes after the URL, for example:

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

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

Emphasize

Markdown uses the asterisk (*) and the Bottom line (_) as the symbol to emphasize the word, the word surrounded by * or _ will be converted into a <em> tag and surrounded by two * or _, then it will be converted into <STRONG>, for example:

Copy Code code as follows:

*single asterisks*

_single Underscores_

**double asterisks**

__double underscores__

Code

If you want to mark a short line of code, you can wrap it in an inverted quotation mark ('), for example:

Will be turned into ' <strong> '

Image

Obviously, it is difficult to design a "natural" grammar to insert a picture in a pure text application. Markdown uses a syntax similar to a link to mark a picture, and also allows two styles: inline and reference. Here's a description of inline only:

Copy Code code as follows:

! [Alt text] (/path/to/img.jpg)

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

The detailed description is as follows:

An exclamation!
Then a square bracket with the alternate text of the picture
Then an ordinary bracket, where the image of the URL, and finally can be wrapped in quotes and add the optional ' title ' text.

(c) Other

Automatic link

Markdown supports the use of a shorter form of automatic link processing URLs and e-mail boxes, as long as they are wrapped in square brackets, markdown will automatically turn it into a link. The link text for a generic URL is the same as a link address, for example:

Copy Code code as follows:

<address@example.com>

Markdown will be converted to:
Copy Code code as follows:

<a href= "http://example.com/" >http://example.com/</a>
<a href= "mailto:address@example.com" >address@example.com</a>

Back slash

Markdown can use backslashes to insert symbols that have other meanings in the syntax, such as: If you want to add an asterisk to the text next to the emphasis (but not <em> tags), you can precede the asterisk with a backslash: literal asterisks Markdown supports the following symbols preceded by a backslash to help insert common symbols:

Copy Code code as follows:

\ Backslash
' Inverted quotes
* Asterisk
_ Bottom Line
{} curly Braces
[] square brackets
() Bracket
# Well Size
+ Plus
-Minus sign
. English period
! Exclamation

Markdown Editor

Markdown's editor basically supports real-time preview, here are a few of the features I'm using.

1. I am using the Woidows markdown Editor is Markdownpad 2, feel good
2. Online editor has Mahua
3.wordpress Editor: Wp-markdown

Reference links

Markdown Syntax Description (Simplified Chinese version): http://wowubuntu.com/markdown/

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.