GitHunt
AN

aniav/gitbook-plugin-codeblock-label

Gitbook Plugin: Add labels to codeblocks

This is a gitbook plugin.

Id adds a label to codeblocks, it's useful for adding filenames over code blocks.

Usage

You can install this plugin via NPM and save it to package.json.
The plugin requires gitbook >= 3, for older versions see the original package.

$ npm install gitbook-plugin-codeblock-label --save

Add the plugin to your book.json:

{
	plugins: [ "codeblock-label" ]
}

Then, you need only to insert before codeblock the code below.


{% label %}filename{% endlabel %}
```
codeblock
```

Example

write this code ↓


{% label %}test.js{% endlabel %}
```js
var a = 10;
a = a + 1;

console.log(a);
```

then result is ↓

screenshot

Contributors

MIT License
Created June 5, 2015
Updated February 23, 2026