美文网首页GIt
解决GitBook不支持[TOC]生成的本页目录

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

作者: Devops海洋的渔夫 | 来源:发表于2019-04-18 21:53 被阅读247次

问题如下

在编写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展示看看

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

相关文章

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

    问题如下 在编写GitBook的过程中,不可能避免有些篇章会篇幅比较长,此时就会想到markdown有个[TOC]...

  • Markdown-简要总结

    Markdown 目录 用 [TOC]来生成目录: [TOC]<简书暂不支持?> 简介 markdown的设计用低...

  • 简书制作目录

    问题: 解决方案方案1:方案2: 问题: 简书不支持[TOC]生成目录。 解决方案 网上给了很多解决方案,挺麻烦。...

  • Jenkins实现Gitbook自动部署

    nodeJS安装 gitbook安装 生成gitbook 书写SUMMARY.md目录结构 新增book.json...

  • TOC-生成目录

    #TOC-生成目录 markdown编辑器mou怎么生成目录?

  • Markdown 基本技巧__总结

    生成目录 [TOC]在想放置目录的地方添加上述字符(简书 可能不支持该表达方式) 标题(# 开头) 二级标题 三级...

  • markdown入门

    #TOC-生成目录 markdown编辑器mou怎么生成目录?

  • Xcode8以及iOS10问题记录

    [toc]简书不支持目录跳转,好可恶 1.解决工程中输出无关日志 Edit Scheme -> Run -> Ar...

  • 简书生成目录

    因为简书不支持 [TOC] 语法,导致在看长博客时非常不方便,所以特此记录生成简书目录侧边栏的方式。 效果 方法 ...

  • C++ 具名要求:aggregate(聚类),PODs->>(t

    (由于简书目前不支持[toc]无法快速生成目录,所以可能看起来会有点长。)这篇文章的参考处:https://sta...

网友评论

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

    本文链接:https://www.haomeiwen.com/subject/duvnwqtx.html