目錄
Markdown: Basics (快速入门) / (点击查看完整语法说明)
Getting the Gist of Markdown's Formatting Syntax
段落、标题、区块代码
A First Level Header
A Second Level Header
Header 3
This is an H2 in a blockquote
修辞和强调
列表
链接
图片
代码
首頁 web前端 html教學 Markdown 语法快速入门_html/css_WEB-ITnose

Markdown 语法快速入门_html/css_WEB-ITnose

Jun 24, 2016 am 11:20 AM

声明:这份文档派生(fork)于 繁体中文版,在此基础上进行了繁体转简体工作,并进行了适当的润色。此文档用 Markdown 语法编写,你可以到这里 查看它的源文件。「繁体中文版的原始文件可以 查看这里」--By @ riku

注:本项目托管于 GitCafe上,请通过"派生"和"合并请求"来帮忙改进本项目。

Markdown: Basics (快速入门) / (点击查看完整语法说明)

Getting the Gist of Markdown's Formatting Syntax

此页提供了 Markdown 的简单概念, 语法说明页提供了完整详细的文档,说明了每项功能。但是 Markdown 其实很简单就可以上手,此页文档提供了一些范例,并且每个范例都会提供输出的 HTML 结果。

其实直接试试看也是一个很不错的方法, Dingus是一个网页应用程序,你可以把自已编写的 Markdown 文档转成 XHTML。

段落、标题、区块代码

一个段落是由一个以上的连接的行句组成,而一个以上的空行则会划分出不同的段落(空行的定义是显示上看起来像是空行,就被视为空行,例如有一行只有空白和 tab,那该行也会被视为空行),一般的段落不需要用空白或换行缩进。

Markdown 支持两种标题的语法, Setext和 atx形式。Setext 形式是用底线的形式,利用 =(最高阶标题)和 -(第二阶标题),Atx 形式在行首插入 1 到 6 个 #,对应到标题 1 到 6 阶。

区块引用则使用 email 形式的 ' >' 角括号。

Markdown 语法:

A First Level Header====================A Second Level Header---------------------Now is the time for all good men to come tothe aid of their country. This is just aregular paragraph.The quick brown fox jumped over the lazydog'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 id="A-First-Level-Header">A First Level Header</h1><h2 id="A-Second-Level-Header">A Second Level Header</h2><p>Now is the time for all good men to come tothe aid of their country. This is just aregular paragraph.</p><p>The quick brown fox jumped over the lazydog's back.</p><h3 id="Header">Header 3</h3><blockquote><p>This is a blockquote.</p><p>This is the second paragraph in the blockquote.</p><h2 id="This-is-an-H-in-a-blockquote">This is an H2 in a blockquote</h2></blockquote>
登入後複製

修辞和强调

Markdown 使用星号和底线来标记需要强调的区段。

Markdown 语法:

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>
登入後複製

列表

无序列表使用星号、加号和减号来做为列表的项目标记,这些符号是都可以使用的,使用星号:

* Candy.* Gum.* Booze.
登入後複製

加号:

+ Candy.+ Gum.+ Booze.
登入後複製

和减号

- Candy.- Gum.- Booze.
登入後複製

都会输出 HTML 为:

<ul><li>Candy.</li><li>Gum.</li><li>Booze.</li></ul>
登入後複製

有序的列表则是使用一般的数字接着一个英文句点作为项目标记:

1. Red2. Green3. Blue
登入後複製

输出 HTML 为:

<ol><li>Red</li><li>Green</li><li>Blue</li></ol>
登入後複製

如果你在项目之间插入空行,那项目的内容会用

包起来,你也可以在一个项目内放上多个段落,只要在它前面缩排 4 个空白或 1 个 tab 。

* A list item.    With multiple paragraphs.* Another item in the list.
登入後複製

输出 HTML 为:

<ul><li><p>A list item.</p><p>With multiple paragraphs.</p></li><li><p>Another item in the list.</p></li></ul>
登入後複製

链接

Markdown 支援两种形式的链接语法: 行内和 参考两种形式,两种都是使用角括号来把文字转成连结。

行内形式是直接在后面用括号直接接上链接:

This is an [example link](http://example.com/).
登入後複製

输出 HTML 为:

<p>This is an <a href="http://example.com/">example link</a>.</p>
登入後複製

你也可以选择性的加上 title 属性:

This is an [example link](http://example.com/ "With a Title").
登入後複製

输出 HTML 为:

<p>This is an <a href="http://example.com/" title="With a Title">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"
登入後複製

输出 HTML 为:

<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>
登入後複製

title 属性是选择性的,链接名称可以用字母、数字和空格,但是不分大小写:

I start my morning with a cup of coffee and[The New York Times][NY Times].[ny times]: http://www.nytimes.com/
登入後複製

输出 HTML 为:

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

图片

图片的语法和链接很像。

行内形式(title 是选择性的):

![alt text](/path/to/img.jpg "Title")
登入後複製

参考形式:

![alt text][id][id]: /path/to/img.jpg "Title"
登入後複製

上面两种方法都会输出 HTML 为:

<img src="/static/imghw/default1.png"  data-src="/path/to/img.jpg"  class="lazy" alt="alt text" title="Title" />
登入後複製

代码

在一般的段落文字中,你可以使用反引号 `来标记代码区段,区段内的 &、 <和 >都会被自动的转换成 HTML 实体,这项特性让你可以很容易的在代码区段内插入 HTML 码:

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-encodedentites like <code>&#8212;</code>.</p>
登入後複製

如果要建立一个已经格式化好的代码区块,只要每行都缩进 4 个空格或是一个 tab 就可以了,而 &、 <和 >也一样会自动转成 HTML 实体。

Markdown 语法:

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>
登入後複製

输出 HTML 为:

<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 class="brush:php;toolbar:false"><code><blockquote><p>For example.</p></blockquote></code>
登入後複製
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 個月前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
1 個月前 By 尊渡假赌尊渡假赌尊渡假赌
威爾R.E.P.O.有交叉遊戲嗎?
1 個月前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

&gt; gt;的目的是什麼 元素? &gt; gt;的目的是什麼 元素? Mar 21, 2025 pm 12:34 PM

本文討論了HTML&lt; Progress&gt;元素,其目的,樣式和與&lt; meter&gt;元素。主要重點是使用&lt; progress&gt;為了完成任務和LT;儀表&gt;對於stati

&lt; datalist&gt;的目的是什麼。 元素? &lt; datalist&gt;的目的是什麼。 元素? Mar 21, 2025 pm 12:33 PM

本文討論了html&lt; datalist&gt;元素,通過提供自動完整建議,改善用戶體驗並減少錯誤來增強表格。Character計數:159

&lt; meter&gt;的目的是什麼。 元素? &lt; meter&gt;的目的是什麼。 元素? Mar 21, 2025 pm 12:35 PM

本文討論了HTML&lt; meter&gt;元素,用於在一個範圍內顯示標量或分數值及其在Web開發中的常見應用。它區分了&lt; meter&gt;從&lt; progress&gt;和前

視口元標籤是什麼?為什麼對響應式設計很重要? 視口元標籤是什麼?為什麼對響應式設計很重要? Mar 20, 2025 pm 05:56 PM

本文討論了視口元標籤,這對於移動設備上的響應式Web設計至關重要。它解釋瞭如何正確使用確保最佳的內容縮放和用戶交互,而濫用可能會導致設計和可訪問性問題。

HTML容易為初學者學習嗎? HTML容易為初學者學習嗎? Apr 07, 2025 am 12:11 AM

HTML適合初學者學習,因為它簡單易學且能快速看到成果。 1)HTML的學習曲線平緩,易於上手。 2)只需掌握基本標籤即可開始創建網頁。 3)靈活性高,可與CSS和JavaScript結合使用。 4)豐富的學習資源和現代工具支持學習過程。

&lt; iframe&gt;的目的是什麼。 標籤?使用時的安全考慮是什麼? &lt; iframe&gt;的目的是什麼。 標籤?使用時的安全考慮是什麼? Mar 20, 2025 pm 06:05 PM

本文討論了&lt; iframe&gt;將外部內容嵌入網頁,其常見用途,安全風險以及諸如對象標籤和API等替代方案的目的。

HTML,CSS和JavaScript的角色:核心職責 HTML,CSS和JavaScript的角色:核心職責 Apr 08, 2025 pm 07:05 PM

HTML定義網頁結構,CSS負責樣式和佈局,JavaScript賦予動態交互。三者在網頁開發中各司其職,共同構建豐富多彩的網站。

HTML中起始標籤的示例是什麼? HTML中起始標籤的示例是什麼? Apr 06, 2025 am 12:04 AM

AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。

See all articles