Skip to content

A simple gitbook plugin for adding captions or titles to code blocks.

License

Notifications You must be signed in to change notification settings

wikiti/gitbook-plugin-code-captions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT License npm version

Gitbook Plugin: Add captions to code snippets

Description

A simple gitbook plugin for adding captions or titles to code blocks.

This plugin is based on gitbook-plugin-codeblock-filename.

Installation

Add the plugin to your book.json:

{
	"plugins": [ "code-captions" ]
}

Then install it with gitbook:

gitbook install

Usage

Just add a !CAPTION sentence before the desired block:

!CAPTION This the hello_world.rb file
```ruby
puts "Hello world"
```

Generating the following result:

Sample

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:

Custom sample

Contributors

This project has been developed by:

Avatar Name Nickname Email
Daniel Herzog Wikiti info@danielherzog.es

Releases

No releases published

Packages

No packages published