Markdown 简明语法介绍
2016-04-09 19:52
513 查看
Markdown 简明语法介绍
1. 段落与换行
一个 Markdown 段落是由一个或多个连续的文本行组成,它的上下要有一个以上的空行(也可以包含空格和制表符等),可以插入换行符。普通段落不该用 4 个以上空格或制表符来缩进(否则是代码区块)。2. 斜体和粗体
使用 * 和 * 表示斜体和粗体,也可以使用 _ 和 __ 。如果 和 _ 两边都有空白的话,它们就只会被当成普通的符号。*斜体* **粗体** _斜体_ __粗体__
3. 内容目录
在段落中填写[TOC]以显示全文内容的目录结构,上下必须要有一个以上空行。
4. 标题
在行首插入 1 到 6 个 # ,对应 1 到 6 阶标题。也可以在段落内没有换行符的情况下选中该段落,直接输入 # 。# 第一阶 ## 第二阶 ### 第三阶
5. 区块引用
可以先手动断好行,然后在每行的最前面加上>, 这种方式比较麻烦。
> Deep Learning is a rapidly growing area of machine learning. To learn > more, check out our deep learning tutorial. > > Machine learning has seen numerous successes, but applying learning > algorithms today often means spending a long time hand-engineering the > input feature representation. To address this, researchers have > developed deep learning algorithms that automatically learn a good > representation for the input. These algorithms are today enabling many > groups to achieve ground-breaking results in vision, speech, language, > robotics, and other areas.
也可以在段落内没有换行符的情况下,在每个段落首加上
>,或者选中该段落,直接输入 > 。
> Deep Learning is a rapidly growing area of machine learning. To learn more, check out our deep learning tutorial. > > Machine learning has seen numerous successes, but applying learning algorithms today often means spending a long time hand-engineering the input feature representation. To address this, researchers have developed deep learning algorithms that automatically learn a good representation for the input. These algorithms are today enabling many groups to achieve ground-breaking results in vision, speech, language, robotics, and other areas.
区块引用可以嵌套,只要根据层次加上不同数量的
>,也可以使用其他的 Markdown 语法,包括标题、列表、代码区块等。
> This is the first level of quoting. > > > This is nested blockquote. > > Back to the first level. > > ### This is the nested title. > > 1. Ordered list item1. > 2. Ordered list item2. > > * Unordered list item1. > * Unordered list item2. > > ### Here are some code. > > public class Hello{ > public static void main(String[] args){ > System.out.println("Hello world"); > } > }
6. 列表
无序列表使用星号(*)、加号(+)或是减号(-)作为标记,有序列表则使用数字加一个英文句点,而数字表示的顺序完全不影响编号,即1. 2. 3.和5. 2. 8.都是正确编号。列表的标记和后面的文字之间至少有一个空格或制表符,而列表的标记前面不能有制表符或者 4 个以上空格(否则该段落成为代码区块)。
* Learning Continuous Phrase Representations and Syntactic Parsing with Recursive Neural Networks. * An Analysis of Single-Layer Networks in Unsupervised Feature Learning. 1. Learning Continuous Phrase Representations and Syntactic Parsing with Recursive Neural Networks. 2. An Analysis of Single-Layer Networks in Unsupervised Feature Learning.
如果在同一个列表标记下放置多个段落,则在这些段落前要有 4 个空格或 1 个制表符。
* Machine learning has seen numerous successes, but applying learning algorithms today often means spending a long time hand-engineering the input feature representation. To address this, researchers have developed deep learning algorithms that automatically learn a good representation for the input. These algorithms are today enabling many groups to achieve ground-breaking results in vision, speech, language, robotics, and other areas.
要在列表项目内放进引用,那
>就需要缩进 4 个空格或 1 个制表符。
* A list item with a blockquote: > This is a blockquote > inside a list item.
要在列表项目内放进代码区块的话,该区块就需要缩进 8 个空格或 2 个制表符。
* Here are some code. public class Hello{ public static void main(String[] args){ System.out.println("Hello world"); } }
7. 代码区块
7.1 行内代码区块
使用 `代码` 表示。I'm good at `java`,`python`.
7.2 普通代码区块
只需要将代码段落简单地缩进 4 个空格或 1 个制表符。一个代码区块会一直持续到没有缩进的那一行。Code paragraph block public class Hello{ public static void main(String[] args){ System.out.println("Hello world"); } }
7.3 增强代码区块
使用 3 个反单引号包括,支持四十一种编程语言的语法高亮。如果段落缩进 4 个空格或 1 个制表符则取消语法高亮。```linux $ sudo apt-get install vim-gnome ``` ```java public class Hello{ public static void main(String[] args){ System.out.println("Hello world"); } } ``` ```python @requires_authorization def somefunc(param1='', param2=0): '''A docstring''' if param1 > param2: # interesting print 'Greater' return (param2 - param1 + 1) or None class SomeClass: pass >>> message = '''interpreter ... prompt''' ```
8. 上标注脚
在文本中使用[^keyword]表示上标注脚,其中keyword可以自己定义名称。注脚定义的位置可以在文档的任意位置,最终会显示在文档的末尾,其形式为:
方括号+冒号+一个以上的空格或制表符+注释内容
多个上标注脚需要定义不同的名称以实现自动编号。
这是第一个注脚[^myfootnote1]的样例。 这是第二个注脚[^myfootnote2]的样例。 [^myfootnote1]: 这是第一个注释 [^myfootnote2]: 这是第二个注释
9. 分隔线
可以在一行中用三个以上的星号(*)、减号(-)、下划线(_)来建立一个分隔线,行内不能有其他符号,但是可以插入空格。*** * * * * --- ___
10. 删除线
在文本前后使用 ~~ 表示删除线。~~这是一段错误的文本。~~
11. 链接
行内式链接:前文本
[链接文字](网址链接 "网址标题")后文本
网址标题(可选,可用单引号、双引号或括弧)
参考式链接:
前文本
[链接文字][链接辨别标签]后文本
[链接辨别标签]: 网址链接 "网址标题"
链接辨别标签可以在文档的任意位置但不能有 4 个空格或 1 个制表符的缩进,可以含有字母、数字、空白和标点且不区分大小写,形式为:
方括号+冒号+一个以上的空格或制表符+网址链接(可用尖括号)+网址标题(可选,可用单引号、双引号或括弧)
如果省略链接辨别标签,则相当于链接辨别标签等同于连接文字。
12. 图片
插入图片和插入链接相似:行内式链接:
![链接文字](图片链接 "图片标题")
参考式链接:
![链接文字][链接辨别标签]
[链接辨别标签]: 图片链接 "图片标题"
13. LaTeX 公式
单个 $ 表示行内公式:质能守恒方程可以用一个很简洁的方程式 $E=mc^2$ 来表达。
两个 $$ 表示整行公式:
$$\sum_{i=1}^n a_i=0$$ $$f(x_1,x_x,\ldots,x_n) = x_1^2 + x_2^2 + \cdots + x_n^2 $$ $$\sum^{j-1}_{k=0}{\widehat{\gamma}_{kj} z_k}$$
14. 表格
可以使用 : 来定义表格的对齐方式,使用 - 来控制每列的宽度:| Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 |
相关文章推荐
- 《Android 开发艺术探索》读书笔记二 Activity的启动模式(launchMode)
- oracle学习 第一章 简单的查询语句 ——01
- 使用VS2010开发的MFC Ribbon应用程序运行后关闭了属性界面、输出界面、类视图、通知栏等再次恢复方法
- CANOpen的几种操作以及数据
- 四则运算四
- 2016华为笔试题——置位比特位置查找
- Flume日志收集 总结
- [Android] AIDL浅析
- 从java进程里dump出类的class文件的小工具--dumpclass
- [BZOJ1208] [HNOI2004] 宠物收养所 - splay
- 将整数字符串转成整数型
- iOS-面试题整理
- 在jsp上 设置时间格式
- 第七周实践项目1————线段类——成员函数、友元函数和一般函数的综合及学习心得
- 谁再说Matlab速度慢,我跟谁急
- 第六周作业
- EF增删改查操作
- 第七周项目1-点类-友元函数
- Java中equals和==的区别
- text detection method