Gitbook Plugin: Add Filename to Codeblock
This is a gitbook plugin.Add filename to codeblock.
Usage
You can install this plugin via NPM and save it topackage.json
.$ npm install gitbook-plugin-codeblock-filename --save
Add the plugin to your
book.json
:{
plugins: [ "codeblock-filename" ]
}
Then, you need only to insert before codeblock the code below.
!FILENAME filename
codeblock
You can also write below like qiita,
```js:test.js
codeblock
</code></pre>
Code format is not necessary. So you can exclude `js`.
You can also write below,
<pre><code>
```:test.js
codeblock
Then, you can see the filename on top of the codeblock.
Example
write this code ↓
!FILENAME test.js
var a = 10;
a = a + 1;
console.log(a);
then result is ↓
