gitbook-plugin-filecoin
v1.0.5
Published
GitBook.com compatibility plugin for gitbook-cli with custom blocks (tabs, embed, hints) and a CLI wrapper for Node v10 management
Maintainers
Readme
gitbook-plugin-filecoin
A GitBook 3.x plugin providing custom blocks (tabs, hints, embed) and a CLI wrapper that manages the legacy Node.js v10 environment required by gitbook-cli.
Features
Custom Blocks
Tabs - Create tabbed content:
{% tabs %}
{% tab title="JavaScript" %}
console.log('Hello');
{% endtab %}
{% tab title="Python" %}
print('Hello')
{% endtab %}
{% endtabs %}Hints - Styled callout boxes:
{% hint style="info" %}
This is an info hint.
{% endhint %}
{% hint style="warning" %}
This is a warning.
{% endhint %}
{% hint style="danger" %}
This is a danger alert.
{% endhint %}
{% hint style="success" %}
This is a success message.
{% endhint %}Embed - Embed external content:
{% embed url="https://www.youtube.com/watch?v=..." %}CLI Wrapper
The package includes a gitbook-cli command that:
- Automatically manages Node.js v10 via nvm (required by legacy gitbook-cli)
- Provides build, serve, preview, and stop commands
- Includes file watching with live reload for development
Installation
npm install gitbook-plugin-filecoin --save-devConfiguration
book.json
{
"gitbook": "3.2.3",
"plugins": ["filecoin"],
"styles": {
"website": "node_modules/gitbook-plugin-filecoin/assets/website.css"
}
}package.json Scripts
{
"scripts": {
"setup": "gitbook-cli setup",
"build": "gitbook-cli build",
"dev": "gitbook-cli serve",
"preview": "gitbook-cli preview",
"stop": "gitbook-cli stop"
}
}Usage
First-Time Setup
npm run setupThis installs gitbook-cli and GitBook v3.2.3.
Development
npm run devStarts a development server with live reload at http://localhost:4003.
Build
npm run buildBuilds the static site to _book/.
Preview
npm run previewServes an existing _book/ directory without rebuilding.
Requirements
- Node.js: 16+ for building/running the CLI
- nvm: Required for Node.js v10 management (used internally by gitbook-cli)
- GitBook: 3.2.3 (automatically installed by setup)
Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| GITBOOK_PROJECT_ROOT | Override project root directory | Current working directory |
License
MIT
