首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >解决GitBook不支持[TOC]生成的本页目录

解决GitBook不支持[TOC]生成的本页目录

作者头像
Devops海洋的渔夫
发布2019-06-02 13:24:34
3.1K0
发布2019-06-02 13:24:34
举报
文章被收录于专栏:Devops专栏Devops专栏Devops专栏

问题如下

在编写GitBook的过程中,不可能避免有些篇章会篇幅比较长,此时就会想到markdown有个[TOC]可以生成目录。 但是在使用GitBook运行服务gitbook serve打开页面的时候,却是不支持的,如下图:

正常文档中的显示如下:

那么有没有什么好办法去处理呢?

解决方法

发现Github的一个项目https://github.com/ekalinin/github-markdown-toc能够帮助我解决这个问题。

安装方式

Linux

$ wget https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc
$ chmod a+x gh-md-toc

OSX

$ curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
$ chmod a+x gh-md-toc

首先我在Centos7安装好工具

[root@centos7 ~]# mkdir gh-md-toc
[root@centos7 ~]# cd gh-md-toc/
[root@centos7 gh-md-toc]# ls
[root@centos7 gh-md-toc]# wget https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc
--2019-04-17 16:33:05--  https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.228.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.228.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8039 (7.9K) [text/plain]
Saving to: ‘gh-md-toc’

100%[======================================================================>] 8,039       16.9KB/s   in 0.5s   

2019-04-17 16:33:07 (16.9 KB/s) - ‘gh-md-toc’ saved [8039/8039]

[root@centos7 gh-md-toc]# ls
gh-md-toc
[root@centos7 gh-md-toc]# chmod a+x gh-md-toc
[root@centos7 gh-md-toc]# 
[root@centos7 gh-md-toc]# ls -ll -h
total 8.0K
-rwxr-xr-x 1 root root 7.9K Apr 17 16:33 gh-md-toc
[root@centos7 gh-md-toc]# 

使用gh-md-toc生成目录

用法:./gh-md-toc 文件.md

[root@centos7 gh-md-toc]# ls
Chapter6.zip  gh-md-toc
[root@centos7 gh-md-toc]# unzip Chapter6.zip 
Archive:  Chapter6.zip
  inflating: 集群节点缩容演练.md  
  inflating: 集群节点扩容演练.md  
[root@centos7 gh-md-toc]# 
[root@centos7 gh-md-toc]# ls
Chapter6.zip  gh-md-toc  集群节点扩容演练.md  集群节点缩容演练.md
[root@centos7 gh-md-toc]# 
[root@centos7 gh-md-toc]# ./gh-md-toc 集群节点扩容演练.md 

Table of Contents
=================

   * [第2节:集群节点扩容演练](#第2节集群节点扩容演练)
      * [演练场景说明](#演练场景说明)
      * [演练步骤](#演练步骤)
      * [部署一主一从、双哨兵](#部署一主一从双哨兵)
         * [配置Master(M1)](#配置masterm1)
         * [配置Slave(R1)](#配置slaver1)
         * [查看主从情况](#查看主从情况)
         * [测试主从写入数据](#测试主从写入数据)
         * [配置双sentinel(S1/S2) 的关键配置](#配置双sentinels1s2-的关键配置)
            * [sentinel (S1) 的配置](#sentinel-s1-的配置)
            * [sentinel (S2) 的配置](#sentinel-s2-的配置)
      * [master故障](#master故障)
         * [模拟master服务故障](#模拟master服务故障)
         * [sentinel的日志](#sentinel的日志)
         * [查看原slave redis(R2)服务是否已经promotion为master节点](#查看原slave-redisr2服务是否已经promotion为master节点)
      * [恢复原master redis节点服务,查看是否转为slave redis](#恢复原master-redis节点服务查看是否转为slave-redis)
         * [启动原master redis节点服务](#启动原master-redis节点服务)
         * [sentinel的日志](#sentinel的日志-1)
         * [检查主从切换后的role以及数据写入情况](#检查主从切换后的role以及数据写入情况)
      * [调整双哨兵 quorum = 2](#调整双哨兵-quorum--2)
         * [修改第一个sentinel(S1)服务](#修改第一个sentinels1服务)
         * [修改第二个sentinel(S2)服务](#修改第二个sentinels2服务)
      * [新增服务器配置 slave redis (R3) 以及 sentinel (S3) 加入集群](#新增服务器配置-slave-redis-r3-以及-sentinel-s3-加入集群)
         * [新增slave redis(R3)](#新增slave-redisr3)
         * [新增第三个sentinel(S3)服务](#新增第三个sentinels3服务)
      * [验证扩容节点之后的数据同步](#验证扩容节点之后的数据同步)
         * [查看新增的slave redis(R3)数据的同步情况](#查看新增的slave-redisr3数据的同步情况)
         * [往master节点写入新数据](#往master节点写入新数据)
         * [查看R3是否同步数据](#查看r3是否同步数据)

Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
[root@centos7 gh-md-toc]# 

将生成的目录数据拷贝到md中

再使用gitbook serve展示看看

算是可以了,点击也可以跳转至对应的标题下。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019.04.18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题如下
  • 解决方法
  • 安装方式
  • 首先我在Centos7安装好工具
  • 使用gh-md-toc生成目录
  • 将生成的目录数据拷贝到md中
  • 再使用gitbook serve展示看看
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档