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

php中文网
发布: 2016-06-24 11:20:28
原创
1597人浏览过

声明:这份文档派生(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>A First Level Header</h1><h2>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>Header 3</h3><blockquote>This is a blockquote.This is the second paragraph in the blockquote.This is an H2 in a blockquote</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>
                    <div class="aritcle_card">
                        <a class="aritcle_card_img" href="/ai/1298">
                            <img src="https://img.php.cn/upload/ai_manual/000/000/000/175680203955338.png" alt="法语写作助手">
                        </a>
                        <div class="aritcle_card_info">
                            <a href="/ai/1298">法语写作助手</a>
                            <p>法语助手旗下的AI智能写作平台,支持语法、拼写自动纠错,一键改写、润色你的法语作文。</p>
                            <div class="">
                                <img src="/static/images/card_xiazai.png" alt="法语写作助手">
                                <span>31</span>
                            </div>
                        </div>
                        <a href="/ai/1298" class="aritcle_card_btn">
                            <span>查看详情</span>
                            <img src="/static/images/cardxiayige-3.png" alt="法语写作助手">
                        </a>
                    </div>
                </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="/path/to/img.jpg" 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>
登录后复制
HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号