Socket
Book a DemoInstallSign in
Socket

gitbook-plugin-prism-code-fox

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitbook-plugin-prism-code-fox

Prism highlighting for gitbook,enable code tab

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Prism Code Tab

Gitbook Plugin for Prism and support code tabs with custom configuartion name.

NPM

Integrate gitbook-plugin-prism and gitbook-plugin-codetabs into one plugin,it not only highlight code using Prism, but can also using Tabs to group these code blocks.

Installation

Adds the plugin to your book.json, then run gitbook install if you are building your book locally.

{
    "plugins": ["prism-code-fox"]
}

Usage

Each code block will render as a tab,the tab name is the language by default,but we can show custom tab name in each code block by using a codeTabSepearator.

The default value of codeTabSepearator is ::, we can set a global value via book.js or set a custom value in each tab group as below:

{% codetab codeTabSeperator="#" %}

​```javascript
 // code block
​```

​```swift#IOS Develop
 // code block
​```

​```java#Java Guide
 // code block
​```

{% endcodetab %}

Priority order is Custom config > Global config > Default config

Default config

Source code:

{% codetab %}

​```javascript
import * as React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, window.document.getElementById('root'));
​```

​```swift
let s: String = "sample";
​```

​```java::Java Guide
class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); 
    }
}
​```

{% endcodetab %}

Display result:

Highlight code tabs with prism

Global config

Config code:

"prism-fox": {
    "theme": "prismjs/themes/prism-solarizedlight.min.css",
    "lang":{
        "dockerfile":"docker"
    },
    "markdown-table-selector": "li > p,blockquote > p",
    "details-summary":"Click to view more+"
}

Source code:

{% codetab %}

​```javascript
import * as React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, window.document.getElementById('root'));
​```

​```swift$IOS Develop
let s: String = "sample";
​```

​```java$Java Guide
class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); 
    }
}
​```

{% endcodetab %}

Display result:

Highlight code tabs with prism

Custom config

Source code:

{% codetab codeTabSeperator="#" %}

​```javascript
import * as React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, window.document.getElementById('root'));
​```

​```swift#IOS Develop
let s: String = "sample";
​```

​```java#Java Guide
class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); 
    }
}
​```

{% endcodetab %}

Display result:

Highlight code tabs with prism

License

Apache License 2.0

FAQs

Package last updated on 22 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts