How to use Markdown

Keywords: Google Attribute

Links to the original text: http://www.cnblogs.com/riasky/p/3363550.html

From: http://wowubuntu.com/markdown/basic.html

Paragraphs, Titles, Block Codes

A paragraph consists of more than one connected line sentence, and more than one blank line is divided into different paragraphs (blank line is defined as a line that looks like blank line on display and is regarded as blank line, for example, if there is only blank line and tab, that line will also be regarded as blank line). Normal paragraph does not need to be blank or replaced. Indent. Markdown supports the grammar of two headings. Setext And atx Form. Setext is in the form of a bottom line, with the use of = (top-level heading) and - (second-level heading), the Atx form inserts 1 to 6# at the beginning of the line, corresponding to headings 1 to 6. Block references use'>'brackets in the form of email.

 

Markdown grammar:

A First Level Header
====================
A Second Level Header
---------------------

Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.

The quick brown fox jumped over the lazy
dog's back.
### Header 3

> This is a blockquote.
> 
> This is the second paragraph in the blockquote.
>
> ## This is an H2 in a blockquote

The output HTML is:

<h1>A First Level Header</h1>
<h2>A Second Level Header</h2>
<p>Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.</p>
<p>The quick brown fox jumped over the lazy
dog's back.</p>
<h3>Header 3</h3>
<blockquote>
<p>This is a blockquote.</p>
<p>This is the second paragraph in the blockquote.</p>
<h2>This is an H2 in a blockquote</h2>
</blockquote>

Rhetoric and Emphasis

Markdown uses asterisks and baselines to mark sections that need to be emphasized.

Markdown grammar:

Some of these words *are emphasized*.
Some of these words _are emphasized also_.
Use two asterisks for **strong emphasis**.
Or, if you prefer, __use two underscores instead__.

The output HTML is:

<p>Some of these words <em>are emphasized</em>.
Some of these words <em>are emphasized also</em>.</p>
<p>Use two asterisks for <strong>strong emphasis</strong>.
Or, if you prefer, <strong>use two underscores instead</strong>.</p>

list

Unordered lists use asterisks, plus and minus signs as item markers for lists. These symbols can be used, using asterisks:

* Candy.
* Gum.
* Booze.

Plus:

+ Candy.
+ Gum.
+ Booze.

And minus sign

- Candy.
- Gum.
- Booze.

Both output HTML as follows:

<ul>
<li>Candy.</li>
<li>Gum.</li>
<li>Booze.</li>
</ul>

Ordered lists are marked with general numbers followed by an English period:

1. Red
2. Green
3. Blue

The output HTML is:

<ol>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ol>

If you insert blank lines between projects, the contents of the project will be wrapped in <p> and you can also put more than one paragraph in a project by indenting four blanks or one tab in front of it.

* A list item.
With multiple paragraphs.

* Another item in the list.

The output HTML is:

<ul>
<li><p>A list item.</p>
<p>With multiple paragraphs.</p></li>
<li><p>Another item in the list.</p></li>
</ul>

link

Markdown supports two forms of link grammar: in-line and reference, both of which use angle brackets to convert text into links.

The in-line form is to connect the links directly with parentheses at the back:

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

The output HTML is:

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

You can also optionally add title attributes:

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

The output HTML is:

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

Links in reference form allow you to give a name to the link, and then you can define the content of the link elsewhere in the document:

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"

The output HTML is:

<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>

The title attribute is optional, and the link name can be alphabetic, numeric, and space, but case-sensitive:

I start my morning with a cup of coffee and
[The New York Times][NY Times].

[ny times]: http://www.nytimes.com/

The output HTML is:

<p>I start my morning with a cup of coffee and
<a href="http://www.nytimes.com/">The New York Times</a>.</p>

picture

Grammar and links of pictures are very similar.

In-line form (title is optional):

![alt text](/path/to/img.jpg "Title")

Reference Form:

![alt text][id]

[id]: /path/to/img.jpg "Title"

Both methods output HTML as follows:

<img src="/path/to/img.jpg" alt="alt text" title="Title" />

Code

In General paragraph text, you can use back quotation marks to mark code sections. The -, < and > within sections are automatically converted to HTML entities. This feature allows you to easily insert HTML codes into code sections:

I strongly recommend against using any `<blink>` tags.

I wish SmartyPants used named entities like `&mdash;`
instead of decimal-encoded entites like `&#8212;`.

The output HTML is:

<p>I strongly recommend against using any
<code>&lt;blink&gt;</code> tags.</p>
<p>I wish SmartyPants used named entities like
<code>&amp;mdash;</code> instead of decimal-encoded
entites like <code>&amp;#8212;</code>.</p>

If you want to create a well-formatted block of code, just indent four spaces or a tab on each line, and &, < and > automatically convert to HTML entities as well.

Markdown grammar:

If you want your page to validate under XHTML 1.0 Strict,
you've got to put paragraph tags in your blockquotes:

<blockquote>
<p>For example.</p>
</blockquote>

The output HTML is:

<p>If you want your page to validate under XHTML 1.0 Strict,
you've got to put paragraph tags in your blockquotes:</p>
<pre><code>&lt;blockquote&gt;
&lt;p&gt;For example.&lt;/p&gt;
&lt;/blockquote&gt;
</code></pre>


Reprinted at: https://www.cnblogs.com/riasky/p/3363550.html

Posted by SoulAssassin on Sat, 27 Jul 2019 04:20:10 -0700