Makedown原理: 新出的一个文档语言,使用性比较强 从后台解释语言到html。 下面是代码
标题
通过‘#’个数 区分h1-6(标题大小)
# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag
效果:
h1>tag
h2>tag
h6> tag
第二种写法:
Hello {#id}
---
# Hello {#id}
# Hello # {#id}
效果
Hello #标题
Hello #id
Hello # #id
——————
列表
无序代码:
- 文本1
* 二级文本
- 文本2
- 文本3
效果:
- 文本1
- 二级文本
- 文本2
- 文本3
有序代码
1. 文本1
1. 2121
2. 电影
2. 文本2
3. 文本3
效果:
- 文本1
- 2121
- 电影
- 文本2
- 文本3
换行
空格和回车都可以
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
重点
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
~~This text will be crossed out.~~
_You **can** combine them_
效果:
This text will be italic
This will also be italic
This text will be bold
This will also be bold
This text will be crossed out.
You can combine them
链接
This is [an example](http://example.com/) inline link with a title.
[This link](http://example.net/) has no title attribute.
效果:
This is an example inline link with a title.
This link has no title attribute.
图片
本地图片: ![gras](/images/GitLearning/image.jpg)
互联网图片: ![gras](https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png)
效果:
模块引用
As Kanye West said:
> We're living the future so
> the present is our past.
效果:
As Kanye West said:
We’re living the future so
the present is our past.
表
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
效果:
First Header | Second Header |
---|---|
Content Cell | Content Cell |
Content Cell | Content Cell |
code
四格或缩进
This is a sample code block.
Continued here.
首行缩进需要用输入法全角格式下按一个空格,如果直接按Tab的话是全部都缩进,且会出现一个代码框样式的框
效果:
This is a sample code block.
Continued here.
语法高亮显示
```这里写上所用的语言,如c++
在这里写代码(代码是被```包起来的)
```
效果:
C++:
#include<iostream>
using namespace std;
int main(){
cout<<"Makedown"<<endl;
return 0;
}
Ruby:
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
Python:
import os
print('hello gitbook!')
内联代码
Use `gitbook` to convert the `text` in markdown
syntax to HTML.
效果:
Use gitbook
to convert the text
in markdown
syntax to HTML.
脚注
GitBook支持这种脚注的简单语法。脚注是相对于每个页面。
Text prior to footnote reference.[^1]
[^1]: Comment to include in footnote.
效果:
Text prior to footnote reference.1
前端语言
GitBook支持在您的文本中使用原始HTML,不处理HTML中的Markdown语法:
<div>
Markdown here will not be **parsed**
</div>
水平规则
Three or more...
---
Hyphens
***
Asterisks
Three or more…
Hyphens
Asterisks
忽略
Let's rename \*our-new-project\* to \*our-old-project\*.
-
Comment to include in footnote. ↩