Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

eleven-net-cn/gitbook-plugin-code-optimize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitBook 插件,给代码块增加复制按钮,显示行号。fork 自 https://github.com/davidmogar/gitbook-plugin-code ,原始插件不够满足我的开发需求,进行了扩展。

Installation

直接 install 安装,或者,在 book.json 写入到 plugin 配置后,再运行 gitbook install 命令安装。

NPM

npm i gitbook-plugin-code-optimize

Yarn

yarn add gitbook-plugin-code-optimize

在 book.json 文件增加 plugin、pluginsConfig 配置:

{
  "plugins": ["code-optimize"],
  "pluginsConfig": {
    "code-optimize": {
      "copyButtons": true,
      "showLines": true
    }
  }
}

Constants

参数名 类型 必填 默认值 说明
copyButtons Boolean true 是否开启代码复制
showLines Boolean true 是否开启显示代码行号

示例

  1. 单行,不显示行号:

    single line

  2. 多行,显示行号:

    multi line

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published