Markdown常用语法示例

简介: 注:本文所有示例均出自Markdown官方文档及github推出的mastering-markdown文档。Markdown简介及作用Markdown的官方文档是这样介绍Markdown的:Markdown is a way to style text on the web.

注:本文所有示例均出自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 Header Second Header
Content from cell 1 Content from cell 2
Content in the first column Content in the second column
目录
相关文章
|
4月前
markdown常用语法--花括号(超详细)
markdown常用语法--花括号(超详细)
|
10天前
【LaTex、markdown】常用语法写出漂亮的blog
【9月更文挑战第9天】本文介绍了使用LaTeX和Markdown编写美观博客的方法。LaTeX方面,需定义文档类型、设置标题与作者,并利用特定命令处理文本格式、列表、数学公式、图片和超链接。Markdown则通过井号表示标题级别,使用星号或下划线标记文本,简化列表和公式的编写,并以直观方式插入图片和链接。两者均可通过合理布局提升博客的可读性和视觉效果。
|
1月前
Markdown使用HTML语法实现复杂表格
Markdown使用HTML语法实现复杂表格
72 1
|
1月前
|
资源调度
机器人学 markdown数学公式常用语法
本文提供了Markdown中数学公式的常用语法,包括行内公式、行间公式、基本运算、矩阵、微积分、大小比较、开根号、表格、角标、头顶标、空格、括号、特殊字符、分式、文字、希腊字母以及分类括号的详细使用方法和示例。
32 1
|
2月前
|
自然语言处理 开发者 Python
Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的 HTML 内容。Markdown 的语法简洁明了、学习容易,而且功能比纯文本更强。
Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的 HTML 内容。Markdown 的语法简洁明了、学习容易,而且功能比纯文本更强。
|
2月前
|
JavaScript
vue 加载展示md文件(markdown语法 .md后缀的文件)
vue 加载展示md文件(markdown语法 .md后缀的文件)
382 0
揭秘Markdown:轻松掌握基础语法,让你的写作更高效、优雅!
揭秘Markdown:轻松掌握基础语法,让你的写作更高效、优雅!
|
3月前
markdown语法
学习Markdown基本语法:标题、段落、强调、列表、代码块等,轻松撰写整洁文档。[查看教程](https://markdown.com.cn/basic-syntax/)
33 0
|
4月前
Markdown基础语法详细版
Markdown基础语法详细版
|
4月前
|
数据采集 数据挖掘 Python
Python之html2text: 将HTML转换为Markdown 文档示例详解
Python之html2text: 将HTML转换为Markdown 文档示例详解
347 0