# GitBook 如果输入gitbook init命令,出现Installing version 2.1.0,需要耐性等待安装。 先到github建立一个仓库,保证有README.md等文件 然后克隆到本地 ## 基本使用 ---- - README.md - 这个文件相当于一本Gitbook的简介。 - SUMMARY.md - 这个文件是一本书的目录结构,使用Markdown语法. - Glossary.md - 对于电子书内容中需要解释的词汇可在此文件中定义。词汇表会被放在电子书末尾。 例如: ``` * [简介](README.md) * [第一章](chapter1/README.md) - [第一节](chapter1/section1.md) - [第二节](chapter1/section2.md) * [第二章](chapter2/README.md) - [第一节](chapter2/section1.md) - [第二节](chapter2/section2.md) * [结束](end/README.md) ``` 其中,中括号内是章节名字,其为书右端可点击转跳的目录。后面小括号内为文件路径。 写完后 ```bash gitbook build ``` 生成html格式书。默认在本地生成 _book 文件夹 然后上传到github 到gitbook 新建 book,从github上选择分支。个人网址后面填写的内容即为外部访问链接地址。 也可以将内容输出到想要的目录 ```bash gitbook build --output= ``` 本地网页预览 ```bash gitbook serve [--port 4000] ``` ---- 忽略文件和文件夹 gitbook 将阅读 .gitignore .bookignore .ignore 文件,跳过文件和文件夹的列表 ### Glossary.md 其格式如下所示: ``` # 电子书 电子书是指将文字、图片、声音、影像等讯息内容数字化的出版物和植入或下载数字化文字、图片、声音、影像等讯息内容的集存储和显示终端于一体的手持阅读器。 # Kindle Amazon Kindle 是由 Amazon 设计和销售的电子书阅读器(以及软件平台)。用户可以通过无线网络使用 Amazon Kindle 购买、下载和阅读电子书、报纸、杂志、博客及其他电子媒体。 ``` ## 电子书封面图片 GitBook 帮助文档建议封面图片的尺寸为 1800*2360 像素并且遵循建议: - 没有边框 - 清晰可见的书本标题 - 任何重要的文字在小版本中应该可见 - 图片的格式为 jpg 格式。把图片重命名为“cover.jpg”放到电子书项目文件夹即可。 ## 多语言 当你需要发布多个语言版本时,根目录只需要放置一个LANGS.md, 格式如下 ```md * [English](en) * [中文](zh) * ... ``` 每个zh,en文件夹现在就相当于一个独立的书籍. ## 插件 - editlink - 内容顶部显示 编辑本页 链接。 - ad - 在每个页面顶部和底部添加广告或任何自定义内容。 - splitter - 在左侧目录和右侧内容之间添加一个可以拖拽的栏,用来调整两边的宽度。 - image-captions - 抓取内容中图片的 alt 或 title 属性,在图片下面显示标题。 - https://plugins.gitbook.com/plugin/image-captions - github - 在右上角显示 github 仓库的图标链接。 - anchors - 标题带有 github 样式的锚点。 - chart - 使用 C3.js 图表。 - https://plugins.gitbook.com/plugin/chart - styles-sass - 使用 SASS 替换 CSS。 - https://plugins.gitbook.com/plugin/styles-sass - styles-less - 使用 LESS 替换 CSS。 - https://plugins.gitbook.com/plugin/styles-less - ga - 添加 Google 统计代码。 - https://plugins.gitbook.com/plugin/ga - disqus - 添加 disqus 评论插件。 - https://plugins.gitbook.com/plugin/disqus - sitemap - 生成站点地图。 - latex-codecogs - 使用数学方程式。 - https://plugins.gitbook.com/plugin/latex-codecogs - mermaid - 使用流程图。 - https://plugins.gitbook.com/plugin/mermaid - book-summary-scroll-position-saver - 自动保存左侧目录区域导航条的位置。 - sharing - 默认的分享插件。 - https://plugins.gitbook.com/plugin/sharing - fontsettings - 默认的字体、字号、颜色设置插件。 - https://plugins.gitbook.com/plugin/fontsettings - search - 默认搜索插件。 - tbfed-pagefooter - 自定义页脚,显示版权和最后修订时间。 - page-footer-ex - 定制页脚 - https://plugins.gitbook.com/plugin/page-footer-ex - prism - 基于 Prism 的代码高亮。 - https://plugins.gitbook.com/plugin/prism - atoc - 插入 TOC 目录。 - ace - 插入代码高亮编辑器。 - https://plugins.gitbook.com/plugin/ace - highlight - 默认的代码高亮插件,通常会使用 prism 来替换。 - github-buttons - 显示 github 仓库的 star 和 fork 按钮。 - sectionx - 分离各个段落,并提供一个展开收起的按钮。 - https://plugins.gitbook.com/plugin/sectionx - mcqx - 使用选择题。 - https://plugins.gitbook.com/plugin/mcqx - include-codeblock - 通过引用文件插入代码。 - fbqx - 使用填空题。 - https://plugins.gitbook.com/plugin/fbqx - spoiler - 隐藏答案,当鼠标划过时才显示。 - https://plugins.gitbook.com/plugin/spoiler - anchor-navigation - 锚点导航。 - youtubex - 插入 YouTube 视频。 - redirect - 页面跳转。 - expandable-chapters - 收起或展开章节目录中的父节点。 - baidu - 使用百度统计。 - duoshuo - 使用多说评论。 - jsfiddle - 插入 JSFiddle 组件。 - jsbin - 插入 JSBin 组件。 - randoms-versions - Display a "select" with other versions of your gitbook. - https://plugins.gitbook.com/plugin/randoms-versions ---- - [GitBook的安装配置以及一些插件信息](http://gitbook.zhangjikai.com/) - [使用gitbook制作属于自己的电子书](https://www.zybuluo.com/yangfch3/note/158290) - [gitbook--好用的编写API文档工具](https://blog.csdn.net/lintcgirl/article/details/54314113) - [实用配置及插件介绍](https://blog.csdn.net/zhangjk1993/article/details/50380403) - [使用GitBook, Git github, Markdown 快速发布你的书籍](https://www.cnblogs.com/elesos/p/7157429.html) > http://www.css88.com/archives/6622 > https://www.kancloud.cn/xiaoyulive/gitbook/506502