A simple gitbook plugin for adding captions or titles to code blocks.
This plugin is based on gitbook-plugin-codeblock-filename.
Add the plugin to your book.json
:
{
"plugins": [ "code-captions" ]
}
Then install it with gitbook
:
gitbook install
Just add a !CAPTION
sentence before the desired block:
!CAPTION This the hello_world.rb file
```ruby
puts "Hello world"
```
Generating the following result:
To override the CSS style, include this in your CSS files:
div.code-caption > span.code-caption-text {
background-color: rgba(255, 0, 0, 0.07);
/* Your css rules */
}
Generating the following result:
This project has been developed by:
Avatar | Name | Nickname | |
---|---|---|---|
Daniel Herzog | Wikiti | info@danielherzog.es |