0.3.1 • Published 6 years ago

gitbook-plugin-csv-render v0.3.1

Weekly downloads
2
License
Apache 2
Repository
github
Last release
6 years ago

gitbook-plugin-csv-render

This is the little bug fix version from the raw gitbook-plugin-include-csv

What is it?

A Gitbook plugin for including and rending CSV file in your book.

How to install it?

You can install via NPM:

$ npm install --save gitbook-plugin-include-csv

And config your book.json file.

{
    "plugins": ["include-csv"]
}

How to use it?

Insert includeCsv tag into your Gitbook pages.

{% includeCsv src="./hoge.csv" %}{% endincludeCsv %}

example1

{% includeCsv %}
hoge,fuga
a,0001
b,002
{% endincludeCsv %}

example2

Arguments

namedescriptionexample
srcThe file path for including CSV file."./filename.csv"
linkSrcLink to CSV file above the table."true"
encodingcharacter encoding in CSV file."shift_jis"
useHeaderuse 1st row for header."true"
exHeadersdefine column headers."col01,col02"
limitload limit number of rows.5

usage example

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 %}

example3

Show the table from tag body, is row is header.

{% includeCsv useHeader="true" %}
c1,c2,c3
1,1,1
2,2,2
{% endincludeCsv %}

example4

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 %}

example5