GitBook
安装
sudo apt-get install nodejs
sudo apt install npm
sudo npm install gitbook-cli -g
sudo ln -s /usr/bin/nodejs /usr/bin/node #Ubuntu下已存在node库,Node.js在ubuntu下默认叫nodejs,需要额外处理
启动
gitbook init ./directory # 创建并初始化
gitbook serve # 预览书籍 默认端口localhost:4000
Markdown
粗斜体
*这是斜体*
_这也是斜体_
**这是粗体**
__这也是粗体__
~~这句话会被删除~~
_粗体斜体**能**混合使用
这是斜体 这也是斜体
这是粗体 这也是粗体
这句话会被删除
粗体斜体能混合使用
表格
| 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
四个空格或一个Tab缩进
print Hello World!
print Hello World!
语句块
```
function test() {
console.log("notice the blank line before this function?");
}
```
function test() {
console.log("notice the blank line before this function?");
}
语法高亮
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
语句中代码
Use `gitbook` to convert the `text` in markdown
syntax to HTML.
Use gitbook
to convert the text
in markdown
syntax to HTML.
脚注
Text prior to footnote reference.[^2]
[^2]: Comment to include in footnote.
Text prior to footnote reference.2
2. Comment to include in footnote. ↩
HTML
<div>
Markdown here will not be **parsed**
</div>
Markdown here will not be **parsed**
‘\’ 忽略MarkDown语法
Let's rename \*our-new-project\* to \*our-old-project\*.
Let's rename *our-new-project* to *our-old-project*.
.gitignore文件
#
注释行dir/
忽略dir目录*.zip
忽略zip文件ignore.md
忽略单个文件!
不忽略doc/*.txt
忽略doc目录下的txt文件,但不包括其他子目录下的txt文件