Markdown语法学习笔记-----基本语法

段落(<p>):一个以上的链接的行句子组成,以一个以上的空行划分出不同的段落。


标题(<ht>~<h6>):有两种形式,Setext(底线形式),=(<h1>)和-(<h6>);Atx(行首插入),<h1>~<h6>分别对应 # 的个数


示例(来自官方):


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


等价于HTML:


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


强调(<em>,<strong>):用星号(*)和下滑线(_,__)来标记


例子:

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

HTML:

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


列表(<li>):无序列表在项目中使用(*,+,-)来表示,而有序是使用数字加英文句点后加项目来实现


例子(同+-):

* Candy.
* Gum.
* Booze


1. Red
2. Green
3. Blue


HTML:

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


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



PS:如果你在项目之间插入空行,那项目的内容会用;包起来,你也可以在一个项目内放上多个段落,只要在它前面缩排 4 个空白或 1 个 tab


链接(<a>)


行内形式:

<span style="white-space:pre">	</span>This is an [example link](http://example.com/).

加了title属性后

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


等价于:

<span style="white-space:pre">	</span><p>This is an <a href="http://example.com/">
<span style="white-space:pre">	</span>example link</a>.</p>


<span style="white-space:pre">	</span><p>This is an <a href="http://example.com/" title="With a Title">
<span style="white-space:pre">	</span>example link</a>.</p>

参考形式:

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"

等价于

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



图片(<img>):

行内:

<span style="white-space:pre">	</span>![alt text](/path/to/img.jpg "Title")

参考:

<span style="white-space:pre">	</span>![alt text][id]

<span style="white-space:pre">	</span>[id]: /path/to/img.jpg "Title"

等价于:

<span style="white-space:pre">	</span><img src="/path/to/img.jpg" alt="alt text" title="Title" />


代码(<code>):用反引号·来表示


例子:

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

I wish SmartyPants used named entities like `—`
instead of decimal-encoded entites like `—`.

HTML:

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值