markdown语法学习
Contents
markdown,为写作而生,没错,你现在在我的博客看到的文章都是markdown写的。无论是谁,只要需要写文字,都应该学习markdown。第一次接触到markdown,真会有一种相见恨晚的感觉。
1. 标题
markdown支持5级标题,用#的数量来控制级别
# 标题
## 标题
### 标题
#### 标题
##### 标题
显示效果为
标题
标题
标题
标题
标题
2. 列表
markdown支持有序和无序列表,并且支持列表嵌套
- 列表1
- 列表2
- 列表3
1. 列表1
2. 列表2
3. 列表3
显示效果:
- 列表1
- 列表2
- 列表3
- 列表1
- 列表2
- 列表3
列表嵌套:
- 列表1
- 列表1.1
+ 列表2
+ 列表2.1
3. 列表3
1. 列表3.1
2. 列表3.2
3. 列表3.3
显示效果:
- 列表1
- 列表1.1
- 列表2
- 列表2.1
- 列表3
- 列表3.1
- 列表3.2
- 列表3.3
3. 粗体、斜体
*粗体*
**粗体**
***粗斜体***
显示效果:
粗体
粗体
粗斜体
4. 换行
markdown的换行一般通过句子尾部加上两个空格和回车来实现
我想要(两个空格)
换行
效果:
我想要
换行
5. 代码高亮
markdown支持代码高亮,实现方式很简单。只需要用三个 ` 包含起来就可以了
显示效果:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.drawerlayout = (LinearLayout) findViewById(R.id.drawer_layout);
this.snackbarPosition = (CoordinatorLayout) findViewById(R.id.snackbarPosition);
this.appbar = (AppBarLayout) findViewById(R.id.appbar);
// this.tabs = (TabLayout) findViewById(R.id.tabs);
this.toolbar = (Toolbar) findViewById(R.id.toolbar);
// toolbar.setNavigationIcon(R.mipmap.ic_launcher);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
markdown支持的高亮语言列表: http://macdown.uranusjr.com/features/
6. 分割线
分割线可以使用
---
或者
***
显示效果:
7. 引用
一个小于号就能实现引用效果
>引用
效果:
引用
8. 超链接
中括号+括号
[IT驿站](http://www.ithome.me)
效果: IT驿站
9. 图片
只是比超链接多了一个!号
![](http://ww4.sinaimg.cn/large/62b0904dgw1eupntvq54ij20by0bygmf.jpg)
效果:
9. 表格
markdown的表格用起来比较麻烦,我一般都是直接用html的表格
| Left Aligned | Center Aligned | Right Aligned |
|:------------- |:---------------:| -------------:|
| col 3 is | some wordy text | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
效果:
Left Aligned | Center Aligned | Right Aligned |
---|---|---|
col 3 is | some wordy text | $1600 |
col 2 is | centered | $12 |
zebra stripes | are neat | $1 |