A Gitbook plugin for including and rending CSV file in your book.
You can install via NPM:
$ npm install --save gitbook-plugin-include-csv
And config your book.json file.
{
"plugins": ["include-csv"]
}
Insert includeCsv
tag into your Gitbook pages.
{% includeCsv src="./hoge.csv" %}{% endincludeCsv %}
{% includeCsv %}
hoge,fuga
a,0001
b,002
{% endincludeCsv %}
name | description | example |
---|---|---|
src | The file path for including CSV file. | "./filename.csv" |
linkSrc | Link to CSV file above the table. | "true" |
encoding | character encoding in CSV file. | "shift_jis" |
useHeader | use 1st row for header. | "true" |
exHeaders | define column headers. | "col01,col02" |
limit | load limit number of rows. | 5 |
Show the table from csv file, 1st row is header, file's encoding is shift_jis(japanese traditional encoding format).
{% includeCsv src="./sample_records.csv", encoding="shift_jis", useHeader="true" %}{% endincludeCsv %}
Show the table from tag body, is row is header.
{% includeCsv useHeader="true" %}
c1,c2,c3
1,1,1
2,2,2
{% endincludeCsv %}
Show the table from csv file, define column headers directory, set limit of rows.
{% includeCsv
src="./train.1.csv",
exHeaders="PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked",
limit=2 %}
{% endincludeCsv %}