GitBook commonly used plug-ins

GitBook global settings

Learn from Mingyue, the content in the blog, and organize the following content after using it yourself.

title title

Set the title of the book. Add the following to
book.json :

{
    
    
    "title" : "Ruarua"
}

author author

Information about the author. Add the following to
book.json :

{
    
    
    "author" : "ycc"
}

description description

A brief description of the book. Add the following to
book.json :

{
    
    
    "description" : "记录Gitbook的配置和一些插件的使用"
}

language language

The languages ​​used by Gitbook, the available languages ​​in version 2.6.4 are as follows:
en, ar, bn, cs, de, en, es, fa, fi, fr, he, it, ja, ko, no, pl, pt, ro, ru, sv, uk, vi, zh-hans, zh-tw
For example, to configure Simplified Chinese, add the following content to book.json :

{
    
    
    "language" : "zh-hans"
}

GitBook common plugins

To add GitBook common plug-ins, you first need to add the book.json file in the project directory folder , then enter the corresponding content in book.json , and enter gitbook install in the console under the project directory to install it.

toggle-chapters Collapse Table of Contents

By default, only the title of the chapter is displayed in the directory navigation, and the title of the subsection is not displayed. Clicking on each chapter or each section will display the subdirectory of the current chapter or section, if any, but will also collapse other previously expanded chapters. Add the following to
book.json :

{
    
    
    "plugins": ["toggle-chapters"]
}

hide-element hidden element

It can be used to hide elements you don't want to see, for example, to hide the default GitBook prompt: Published with GitBook , add the following content to book.json :

{
    
    
  "plugins": [
    "hide-element"
  ],
  "pluginsConfig": {
    
    
	"hide-element": {
    
    
		"elements": [".gitbook-link"]
	}
  }
}

tbfed-pagefooter Adds a page footer

Mark the copyright information and the time of the article below each article. Add the following to
book.json :

{
    
    
  "plugins": [
    "tbfed-pagefooter"
  ],
  "pluginsConfig": {
    
    
	"tbfed-pagefooter": {
    
    
		"copyright": "Copyright &copy ruarua 2020",
		"modify_label": "该文章修订时间:",
		"modify_format": "YYYY-MM-DD",
	}
  }
}

sharing-plus sharing page

By default, GitBook only has Facebook, Google+, Twiter, Weibo, and Instapaper. The plug-in can have more sharing methods, or disable specified sharing methods. Add the following to
book.json :

{
    
    
  "plugins": [
    "-sharing","sharing-plus"
  ],
  "pluginsConfig": {
    
    
	"sharing": {
    
    
		  "facebook": "false",
		  "google": "false",
	      "twiter": "false",
		  "qq": "true",
		"all": [
			"facebook","google","twiter","qq"
		]
	}
  }
}

search-pro advanced search

The search supports both Chinese and English, with higher accuracy. Add the following to
book.json :

{
    
    
  "plugins": [
    "-lunr","-search","search-pro"
  ]
}

insert-logo insert logo

Insert the logo above the left navigation bar. Add the following to
book.json :

{
    
    
  "plugins": [
    "insert-logo"
  ],
  "pluginsConfig": {
    
    
	"insert-logo": {
    
    
		"url": "../assets/logo.png",
		"style": "background: none"
	}
  }
}

custom-favicon Modify the title bar icon

Sets the small icon for the browser tab title bar. Add the following to
book.json :

{
    
    
  "plugins": [
    "custom-favicon"
  ],
  "pluginsConfig": {
    
    
	"favicon": "assets/favicon.ico"
	}
  }
}

book.json full code

{
    
    
  "title" : "Ruarua",
  "author" : "ycc",
  "description" : "记录Gitbook的配置和一些插件的使用",
  "language" : "zh-hans",
  "plugins": [
	"toggle-chapters",
	"insert-logo",
	"-sharing",
	"hide-element",
	"tbfed-pagefooter",
	"-lunr",
	"-search",
	"search-pro",
	"custom-favicon"
  ],
  "pluginsConfig": {
    
    
    "tbfed-pagefooter": {
    
    
		"copyright": "Copyright &copy ruarua 2020",
		"modify_label": "该文章修订时间:",
		"modify_format": "YYYY-MM-DD"
	},
	"hide-element": {
    
    
		"elements": [".gitbook-link"]
	},
	"insert-logo": {
    
    
		"url": "../assets/logo.jpg",
		"style": "background: none"
	},
	"favicon": "assets/favicon.ico"
  }
}

Guess you like

Origin blog.csdn.net/qq_46067720/article/details/110518499