Markdown常用语法示例

注:本文所有示例均出自Markdown官方文档及github推出的mastering-markdown文档。

Markdown简介及作用


Markdown的官方文档是这样介绍Markdown的:

Markdown is a way to style text on the web. You control the display of the document; formatting words as bold or italic, adding images, and creating lists are just a few of the things we can do with Markdown.(Markdown是一种Web上表现文本的风格,你可以控制文本的展示:粗体字或者是斜体字,插入图片和创建列表,这些都是我们可以使用Markdown做到的事情)

Markdown用途很广泛,例如Github上的ReadMe.md文档就是使用Markdown这个轻量级的文本表示语言书写的,在简书上,你也可以使用这种语言来编辑你的文章,有些前后端对接的API文档也可以使用Markdown语言编写,这样可以使你的文本更加简单易读。


常用语法展示


标题及字体展示

# 标题文本,可以使文本以标题形式展示,共六级标题,# 一级标题,## 二级标题,依次类推

这是一个六级标题的效果

字体展示

*This text will be italic* _This will also be italic_

**This text wiil be bold** __This will also be italic__

效果: This text will be italic This text will be bold


列表展示
* Item 1
* Item 2
  * Item 2a
  * Item 2b (这些代码会让文本呈现无序列表的形式)
  
1. Item 1
1. Item 2
1. Item 3
   1. Item 3a
   2. Item 3b (这些代码会让文本呈现有序列表的形式)

*   A list item with a blockquote:

    > This is a blockquote
    > inside a list item. (当一个列表包含区块的时候,区块需要缩进)

效果:

  • Item 1
  • Item 2
    • Item 2a
    • Item 2b
  1. Item 1
  2. Item 2
  3. Item 3
    1. Item 3a
    2. Item 3b
  • A list item with a blockquote:

    This is a blockquote
    inside a list item.


图片展示
![Markdown learning](https://upload.jianshu.io/users/upload_avatars/5420272/41b3aee5-049c-4d77-8b22-3a744101e5f9?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240)
这段代码会渲染成下面的图片风格,语法如下:
![图片解释的文本](图片URL)
img_e1e7f5832a1d1673fa897e276fd8bd9c.jpe
Markdown learning

超链接、引用及分隔符
http://github.com - automatic!
[GitHub](http://github.com)   //这是超链接的使用方法

As Kanye West said:
> We're living the future so
> the present is our past. //这是引用的使用方法

`<addr>`   //这是单行代码的使用方法
 \```
这是多行代码的使用方法
 \```  //使用三个引号来表现代码会让代码关键字部分高亮,如果不想让代码高亮,可以在代码部分前面加上四个空格即可

http://github.com - 当直接使用一个URL时会直接解析成超链接
GitHub - 这个超链接依然指向github的官网,只是可以自由编辑他表现出来的文本内容


表格
First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column
First HeaderSecond Header
Content from cell 1Content from cell 2
Content in the first columnContent in the second column
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值