GitBook的使用备忘

GitBook环境搭建

npm install -g gitbook-cli
# 新建目录,如helloworld
cd helloworld
# 执行此语句,需等待一段时间
gitbook init
# 启动服务
gitbook serve

遇到问题

TypeError: cb.apply is not a function

问题描述

在执行gitbook init时,出现此问题

解决办法:

nodejs版本的切换

本人使用的windows系统,切换nodejs版本用到了一个nvm的工具,它可以很方便的安装及切换nodejs的版本。
可参考文档:使用nvm安装不同版本的NodeJS

GitBook应用备忘

如何隐藏底部链接Published with GitBook

参考文档

https://www.jianshu.com/p/23353e771082

操作步骤

1、新建文件

_layouts\website\summary.html

2、编辑文件

{% macro articles(_articles) %}
{% for article in _articles %}
<li class="chapter {% if article.path == file.path and not article.anchor %}active{% endif %}" data-level="{{ article.level }}" {% if article.path %}data-path="{{ article.path|resolveFile }}"{% endif %}>
{% if article.path and getPageByPath(article.path) %}
<a href="{{ article.path|resolveFile }}{{ article.anchor }}">
{% elif article.url %}
<a target="_blank" href="{{ article.url }}">
{% else %}
<span>
{% endif %}
{% if article.level != "0" and config.pluginsConfig['theme-default'].showLevel %}
<b>{{ article.level }}.</b>
{% endif %}
{{ article.title }}
{% if article.path or article.url %}
</a>
{% else %}
</span>
{% endif %}
{% if article.articles.length > 0 %}
<ul class="articles">
{{ articles(article.articles, file, config) }}
</ul>
{% endif %}
</li>
{% endfor %}
{% endmacro %}
<ul class="summary">
{% set _divider = false %}
{% if config.links.sidebar %}
{% for linkTitle, link in config.links.sidebar %}
{% set _divider = true %}
<li>
<a href="{{ link }}" target="_blank" class="custom-link">{{ linkTitle }}</a>
</li>
{% endfor %}
{% endif %}
{% if _divider %}
<li class="divider"></li>
{% endif %}
{% for part in summary.parts %}
{% if part.title %}
<li class="header">{{ part.title }}</li>
{% elif not loop.first %}
<li class="divider"></li>
{% endif %}
{{ articles(part.articles, file, config) }}
{% endfor %}
</ul>

posted on   白首码农  阅读(26)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示