This plugin integrates DataTables in your Gitbook Honkit website, with support for accessible HTML tables.
With regards to support for dynamic data source, note that the plugin can only inject data available at build time, when Gitbook Honkit generates your static website.
- Install the plugin
npm install bcopy/gitbook-plugin-datatables
- Add the plugin to your
book.json
, for example :
{
"plugins": ["datatables"],
(...)
"pluginsConfig":{
"datatables":{
"config-url" : "/data/dtconfig.json",
"default-config": {"pageLength": 50 }
}
}
}
In order to configure your datatables, you can use inline HTML 5 data attributes for simple cases, or provide a JSON object associating a CSS selector with the datatable configuration you wish to see applied to matching DOM elements. For it to work, your JSON file must be valid, as in the example below.
For instance, to configure an HTML table bearing the ID "accounting", you could use :
{
"#accounting":{
"ajax":"/data/objects.txt",
"columns":[
{ "data":"name" },
{ "data":"position" },
{ "data":"office" },
{ "data":"extn" },
{ "data":"start_date" },
{ "data":"salary" }
],
"order":[ [ 2, "asc" ] ],
"rowGroup":{ "dataSrc":"office" }
}
}
- Please refer to https://datatables.net/ for its full and exhaustive list of features.
-
Prerequisites
- You will need a JDK v11+
-
You can use the provided Gradle wrapper to install node locally (Alternatively you must have node v14+ installed)
./gradlew installNode
on Linux / Mac OSX- or
gradlew.bat installNode
on Windows
-
You can then setup your path and install the required dependencies :
- If using the gradle wrapper :
source ./setup-path.sh
npm install
- If using the gradle wrapper :
-
Finally you can run the book in preview mode
npm run serve
Alternatively, you can install NodeJS locally.
- Init gitflow
./gradlew initGitflow
- Develop a new feature with
./gradlew featureStart
./gradlew featureFinish
- Issue a new release with
./gradlew releaseStart
./gradlew releaseFinish
Please refer to https://github.com/hyasinfosec/gitflow-gradle-plugin