Skip to content

Commit

Permalink
add plugins:
Browse files Browse the repository at this point in the history
donate: 打赏
Local Video:  视频播放
toc: 生成目录
Edit Link: 链接到源文件
  • Loading branch information
zhangjikai committed Jun 21, 2016
1 parent e309a1e commit eab8f9e
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@
* [Codeblock-filename - 为代码块添加文件名称](plugins.md#codeblockfilename)
* [ga - google 统计](plugins.md#ga)
* [baidu - 百度统计](plugins.md#baidu)
* [donate - 打赏](plugins.md#donate)
* [Local Video - 使用Video.js播放视频](plugins.md#local-video)
* [toc - 自动生成目录](plugins.md#toc)
* [Edit Link - 链接到当前页源文件上](plugins.md#edit-link)
* [sitemap - 生成sitemap](plugins.md#sitemap)

30 changes: 26 additions & 4 deletions book.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"plugins": [
"disqus",
"-search",
"search-pro",
"advanced-emoji",
"search-pro@1.0.7",
"advanced-emoji@0.1.5",
"github",
"ace",
"emphasize",
Expand All @@ -27,7 +27,11 @@
"expandable-chapters",
"codeblock-filename",
"baidu",
"[email protected]"
"[email protected]",
"donate",
"local-video",
"toc",
"edit-link"

],
"pluginsConfig": {
Expand All @@ -37,6 +41,10 @@
"github": {
"url": "https://github.com/zhangjikai/gitbook-use"
},
"search-pro": {
"cutWordLib": "nodejieba",
"defineWord": ["gitbook-use"]
},

"sharing": {
"weibo": true,
Expand All @@ -62,7 +70,21 @@
},
"sitemap": {
"hostname": "http://gitbook.zhangjikai.com"
}
},

"donate": {
"wechat": "http://zhangjikai.com/resource/weixin.png",
"alipay": "http://zhangjikai.com/resource/alipay.png",
"title": "",
"button": "",
"alipayText": "支付宝打赏",
"wechatText": "微信打赏"
},

"edit-link": {
"base": "https://github.com/zhangjikai/gitbook-use/edit/master",
"label": "Edit This Page"
}

}
}
2 changes: 1 addition & 1 deletion commands.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## 命令
这里主要介绍一下 Gitbook 的命令行工具 `gitbook-cli` 的一些命令, 首先说明两点:
这里主要介绍一下 GitBook 的命令行工具 `gitbook-cli` 的一些命令, 首先说明两点:
* `gitbook-cli``gitbook` 是两个软件
* `gitbook-cli` 会将下载的 gitbook 的不同版本放到 `~/.gitbook`中, 可以通过设置`GITBOOK_DIR`环境变量来指定另外的文件夹

Expand Down
95 changes: 94 additions & 1 deletion plugins.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## GitBook插件
记录一些实用的插件, 如果要指定插件的版本可以使用 `[email protected]`

记录一些实用的插件, 如果要指定插件的版本可以使用 `[email protected]`。下面的插件在 GitBook 的 `2.6.4`版本中可以正常工作,因为一些插件可能不会随着 GitBook 版本的升级而升级,即下面的插件可能不适用高版本的 GitBook,所以这里指定了GitBook的版本。另外一些插件在windows上的安装会有问题,比如 `Search Pro``Mermaid`,我也没有找到特别好的解决办法,如果有知道相关解决办法的,请不吝赐教。

* [Disqus - Disqus评论](#disqus)
* [duoshuo - 多说](#duoshuo)
Expand All @@ -19,6 +20,10 @@
* [Codeblock-filename - 为代码块添加文件名称](#codeblockfilename)
* [ga - google 统计](#ga)
* [baidu - 百度统计](#baidu)
* [donate - 打赏](#donate)
* [Local Video - 使用Video.js播放视频](#local-video)
* [toc - 自动生成目录](#toc)
* [Edit Link - 链接到当前页源文件上](#edit-link)
* [sitemap - 生成sitemap](#sitemap)

### Disqus
Expand Down Expand Up @@ -82,8 +87,10 @@
]
```
使用示例:

:bowtie: :smile: :laughing: :blush: :smiley: :relaxed:


### Github
添加github图标
[插件地址](https://plugins.gitbook.com/plugin/github)
Expand Down Expand Up @@ -312,6 +319,88 @@ google 统计
}
```

### Donate
打赏插件
[插件地址](https://plugins.gitbook.com/plugin/donate)
```json
"plugins": [
"donate"
],
"pluginsConfig": {
"donate": {
"wechat": "http://zhangjikai.com/resource/weixin.png",
"alipay": "http://zhangjikai.com/resource/alipay.png",
"title": "",
"button": "",
"alipayText": "支付宝打赏",
"wechatText": "微信打赏"
}
}
```

### Local Video
使用Video.js 播放本地视频

```json
"plugins": [ "local-video" ]
```
使用示例:为了使视频可以自适应,我们指定视频的`width`为100%,并设置宽高比为`16:9`
```
{% raw %}
<video id="my-video" class="video-js" controls preload="auto" width="100%"
data-setup='{"aspectRatio":"16:9"}'>
<source src="http://zhangjikai.com/resource/demo.mp4" type='video/mp4' >
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
{% endraw %}
```

<br />
{% raw %}
<video id="my-video" class="video-js" controls preload="auto" width="100%" data-setup='{"aspectRatio":"16:9"}'>
<source src="http://zhangjikai.com/resource/demo.mp4" type='video/mp4' >
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
{% endraw %}

### Toc
自动生成本页的目录结构,一般情况下生成的目录是正常的,但是可能会与其他插件冲突,造成生成的目录不正确.
[插件地址](https://plugins.gitbook.com/plugin/toc)
下面的 `pluginsConfig`用来给`ul`添加css样式
```json
"plugins": [
"toc"
],
"pluginsConfig": {
"toc": {
"addClass": true,
"className": "toc"
}
}
```

使用方法: 在需要生成目录的地方加上 &lt;!-- toc --&gt;


### Edit Link
如果将gitbook的源文件保存到github或者其他的仓库上,使用该插件可以链接到当前页的源文件上。
[插件地址](https://plugins.gitbook.com/plugin/edit-link)
```json
"plugins": ["edit-link"],
"pluginsConfig": {
"edit-link": {
"base": "https://github.com/USER/REPO/edit/BRANCH",
"label": "Edit This Page"
}
}
```

### Sitemap
生成sitemap
[插件地址](https://plugins.gitbook.com/plugin/sitemap)
Expand All @@ -331,3 +420,7 @@ google 统计







3 changes: 1 addition & 2 deletions settings.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## GitBook配置
记录GitBook的一些配置信息
记录Gitbook的一些配置信息

* [title - 标题](#title)
* [author - 作者信息](#author)
Expand All @@ -11,7 +11,6 @@
* [pluginsConfig - 插件配置](#pluginsconfig)
* [gitbook - 指定gitbook版本](#gitbook)


### title
设置书本的标题
```json
Expand Down
4 changes: 4 additions & 0 deletions styles/website.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ h1 , h2{
overflow: hidden;
background-color: #e7e7e7;
border-bottom: 1px dotted #e7e7e7;
}

.videocontent{
width: 80%;
}

0 comments on commit eab8f9e

Please sign in to comment.