Markdown syntax description

Source: Internet
Author: User

Overview
Purpose
Markdown aims to achieve "easy to read and write 」.

Readability is the most important in any case. A file written in Markdown format should be directly published in plain text, and does not seem to consist of many labels or format instructions. The Markdown syntax is influenced by some text-to-HTML formats, including Setext, atx, Textile, reStructuredText, Grutatext, and EtText. The biggest source of inspiration is the text email format.

In short, the Markdown syntax is composed of all the symbols. These symbols are carefully selected, and their functions are clear at a glance. For example, adding an asterisk on both sides of the text looks like * Emphasizing *. The Markdown list looks like, well, it is the list. The Markdown block reference looks like a text reference, as you have seen in an email.

HTML compatibility
The goal of Markdown syntax is to become a writing language suitable for the network.

Markdown does not want to replace HTML, and is not even similar to it. It has very few syntax types and only corresponds to a small part of HTML Tag. The idea of Markdown is not to make HTML documents easier to write. In my opinion, HTML is easy to write. Markdown makes it easier to read, write, and modify documents. HTML is a publishing format and Markdown is a writing format. In this way, the Markdown format syntax only covers the scope that can be covered by plain text.

Tags that are not covered by Markdown can be written in HTML directly in the document. You do not need to add HTML or Markdown labels. You only need to add tags directly.

Only some HTML block elements, such as <div>, <table>, <pre>, and <p> tags, must be separated by blank lines before and after the tag, it is also required that the start and end labels cannot be indented by tabs or spaces. The Markdown generator is smart enough to avoid adding unnecessary <p> tags to HTML block tags.

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

This is a common section.

<Table>
<Tr>
<Td> Foo </td>
</Tr>
</Table>

This is another common section.
Note that the Markdown format syntax between HTML block tags will not be processed. For example, if you use the Markdown style * emphasis * in the HTML block, it will be ineffective.

HTML section labels (intra-row) such as <span>, <cite>, and <del> can be freely used in Markdown sections, lists, or titles. According to your personal habits, you can even use HTML tags instead of Markdown. For example, if you prefer HTML <a> or tags, you can directly use these tags without the link or Image Tag syntax provided by Markdown.

Unlike HTML block tags, The Markdown syntax is effective between HTML block tags.

Automatic conversion of special characters
In an HTML file, two characters need special processing: <and &. <Symbol is used to start the tag, and "&" is used to mark HTML objects. If you only want to display the prototype of these characters, you must use the Entity form, such as <; and & amp ;.

& Characters especially make the network document writers suffer. If you want to play AT&T, you must write it as "AT & T 」. The & characters in the URL must also be converted. For example, you want to link:

Http://images.google.com/images? Num = 30 & q = larry + bird
You must convert the URL:

Http://images.google.com/images? Num = 30 & amp; q = larry + bird
Can be placed in the href attribute of the link tag. Needless to say, this is easy to ignore. This may also be the most common error detected by the HTML standard check.

Markdown allows you to naturally write characters, which must be converted. If the & character you use is part of the HTML character entity, it will be retained as it is, otherwise it will be converted to & amp ;.

So if you want to insert a copyright symbol in the document©You can write as follows:

& Copy;
Markdown will keep it unchanged. If you write:

AT&T
Markdown converts it:

AT & amp; T
Similar situations also occur on the <symbol, because Markdown allows HTML compatibility. If you use the <symbol as the identifier of the HTML Tag, Markdown will not perform any conversion on it, however, if you write:

4 <5
Markdown converts it:

4 & lt; 5
However, you must note that within the code range, both the line and block, the <and & symbols will be converted into HTML entities, this feature allows you to easily use Markdown to write HTML code (in HTML syntax, You need to convert all <and & into HTML entities, in order to write the HTML code in the HTML file .)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next Page

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.