Markdown 学习笔记: Basics
Markdown 学习笔记: Basics##
原文:Basics.
了解Markdown格式化句法的要点###
本页对如何使用Markdown提供了一个简单的概述。在“句法”页中对Markdown的所有特性提供了完整的,包含细节的文档。但Markdown应该仅通过浏览几个简单的例子就可以开始使用。本页中的这些例子写成了之前/之后的形式,展示出了Markdown的句法和对应的HTML输出。
另一个有用的方法就是试用下Markdown。Dingus是一个可以输入Markdown格式文本并转换成XHTML格式的web应用。
段落,标题和块引用###
一个段落就是一行或多行连续的文本,由一行或多行空白行分隔开。(空白行可以是任何看起来空白的行,可以包含多个空格或制表符。)普通的段落不应该用空格或制表符缩进。
Markdown提供了两种风格的标题:Setext和atx。用于<h1>和<h2>标签的Setext风格标题,是通过在文字下方分别用等号或连字符实现的。而要实现atx风格的标题,是在行首放置1-6个#号,#号的数量等同于HTML标题的级别。
块引用是用email风格的角括号>来表示。
Markdown:
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
Output:
<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>
短语强调###
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__.
Output:
<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.
都会产生同样的输出:
<ul>
<li>Candy.</li>
<li>Gum.</li>
<li>Booze.</li>
</ul>
有序的列表用数字加上句号作为列表标记。如下:
1. Red
2. Green
3. Blue
输出为:
<ol>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ol>
如果你在列表项之间插入空白行,生成的文本中会有<p>标签。你可以通过在你段落前用四个空格或者一个制表符缩进来制造多段的列表项。
* A list item.
With multiple paragraphs.
* Another item in the list.
输出:
<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/).
输出:
<p>This is an <a href="http://example.com/">
example link</a>.</p>
可选的,你可以在圆括号中包含一个标题参数:
This is an [example link](http://example.com/ "With a Title").
输出:
<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"
输出:
<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>
标题属性是可选的。链接名称可以包含字母,数字或者空格,但不是大小写敏感的。
I start my morning with a cup of coffee and
[The New York Times][NY Times].
[ny times]: http://www.nytimes.com/
输出:
<p>I start my morning with a cup of coffee and
<a href="http://www.nytimes.com/">The New York Times</a>.</p>
图片###
图片句法同引用句法很相像。
内联的(标题可选):

引用风格:
![alt text][id]
[id]: /path/to/img.jpg "Title"
上面两个例子会产生同样的输出:
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
代码###
在通常的段落中,你可以通过将文本包含在重音符`中来产生代码段。任何&符号或角括号会自动转换成HTML实体。这使得用Markdown写HTML的实例代码非常容易。
I strongly recommend against using any `<blink>` tags.
I wish SmartyPants used named entities like `—`
instead of decimal-encoded entites like `—`.
输出:
<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>
要指定一段格式化的代码,将代码块的每行用四个空格或一个制表符缩进。同重音符产生的代码段一样,&等特殊字符也会被自动跳过。
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>
输出:
<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><blockquote>
<p>For example.</p>
</blockquote>
</code></pre>
Markdown 学习笔记: Basics的更多相关文章
- 首秀:Markdown学习笔记
# Markdown学习 ## 标题 ### 三级标题 #### 四级标题 ## 字体 **Hello,World!** *Hello,World!* ***Hello,World!*** ~~Hel ...
- 一、MarkDown学习笔记
MakrDown学习 MarkDown是什么? 是一种纯文件格式的标记语言,跟我们写txt和word是一样的,不过它有一些简单的标记,可以使普通文本具有一定的格式. MarkDown有什么样式? 样式 ...
- 我的 MarkDown 学习笔记
MarkDown 一种用于写作的轻量级[标记语言].它用简洁的语法代替排版,而不像一般的文字处理软件 Word 或者 Pages 有大量的排版.字体设置等. 如果你对文章的样式没有太多要求,只注重写文 ...
- MarkDown 学习笔记
MarkDown是一种适用于网络的书写语言,可以帮助你快速书写文档,不必再纠结文档排版的问题.并且它的语法简单,学习成本低,程序员必备技能...助你快速书写技术文档.文章. 用于书写 MarkDown ...
- Markdown学习笔记(一) 基本的Markdown标签
Markdown是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式. Markdown的语法简洁明了.学习容易,而且功能比纯文本更强,因此有很多人用它写 ...
- Markdown学习笔记
分为两步: 1.阅读Markdown中文官网的文档 2.下载MarkdownPad2将中文官网中文档的例子敲一遍,其中Markdownpad2为官网中推荐的编辑器 备注: 如果只看中文官网文档,不边看 ...
- markdown学习笔记 (一)
##类Atx形式标题 # H1标题(一个井号加文字) ### H3标题(三个井号加文字) ###### H6标题(6个井号加文字) 类setext ======== 一级标题(下行加若干个等号) == ...
- Markdown学习笔记(一)
解决Markdown文件插入图片无法只能本地查看的问题 原因:图片的显示与图片地址关联,写入Markdown时用的本机地址,一旦上传到网络,地址就发生了变化,也就显示不了图片. 寻找免费的图床网站. ...
- MarkDown学习笔记 Typora
快捷方式篇 新建 ctrl + N 新建窗口 ctrl + shift + N 打开md文件 ctrl + O 快速打开 ctrl + P 保存 ctrl + S 另存为 ctrl + shift + ...
随机推荐
- (转)SQL Server 2005附加2008的数据库
1. 生成for 2005版本的数据库脚本 2008 的manger studio -- 打开"对象资源管理器"(没有的话按F8), 连接到你的实例 -- 右键要转到2005 ...
- Edwin windows下基本命令:
Ctrl-Alt-z: 对区域内所有代码求值. Ctrl-x Ctrl-e: 对光标左边或上一个表达式求值. Ctrl-c Ctrl-x: 中断当前求值. Ctrl-a: 移动到行首. Ctrl-e: ...
- Map Resource Definition 中type为 'ArcGIS Server Local'.
在使用 MapResourceManager, Map进行 地图显示 时, 在 Map Resource Definition 的 type 为 ArcGIS Server Local时概述. 1,打 ...
- AngularJs练习Demo16 ngRoute
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- java中IO递归写入
package cn.stat.p1.file; import java.io.BufferedWriter; import java.io.File; import java.io.FileWrit ...
- LIS n*log(n)的理解
很多时候lis 用二分的方法比较方便 这里写一下他的原理 这里仅对严格的最长上升子序列做讨论 这里有两个数列 一个数列是 原串的数列 a1-an 另一个数列是最长上升子序列辅助数列 s数列的长度为 ...
- 神奇的match和replace
源自跟奈落大叔的讨论,PHP和JavaScript的比较. 正则: 先说几个正则写法: () 选择匹配一组, (?:) 降低 () 的优先级, .*? 和 .+? ,阻止 . 和 + 的贪婪. 还有一 ...
- Net线程池设计
Net线程池设计 功能描述: 支持创建多个线程池,并统一管理 支持不同线程池的容量控制,以及最少活动线程的设置 支持不同线程池中活动线程的闲时设置,即线程空闲时间到期后即自动被回收 结构设计: Thr ...
- C++类的数组元素查找最大值问题
找出一个整型数组中的元素的最大值. /*找出一个整型数组中的元素的最大值.*/ #include <iostream> using namespace std; class ArrayMa ...
- 编译内核时出错:/bin/sh: 1: lzop: not found
http://www.deyisupport.com/question_answer/dsp_arm/sitara_arm/f/25/t/71477.aspx 在上面链接中,发现时缺少了 lzop 工 ...