1.0.0 • Published 5 years ago

gitbook-plugin-folding-content v1.0.0

Weekly downloads
18
License
Apache-2.0
Repository
github
Last release
5 years ago

gitbook-plugin-folding-content

This plugin provide a tag to create a folding content in your GitBook.

Just like this:

by W.B.Yeats

Had I the heavens’ embroidered cloths,

Enwrought with golden and silver light,

The blue and the dim and the dark cloths

of night and light and the half-light,

I would spread the cloths under your feet.

But I, being poor, have only my dreams;

I have spread my dreams under your feet,

Tread softly because you tread on my dreams.

Install

Add it to your book.json configuration:

{
  "plugins": ["folding-content"]
}

Add then run install:

gitbook install

Usage

{% fold <parmas> %}
<content>
{% endfold%}

<content> is anything that you want it to be folded,it can be Markdown or HTML.

<params> can be the following options:

paramtypedesc
summaryStringSummary of the content
openBooleanOpen by default
styleStringStyle of the details tag

e.g.

  1. Default

    {% fold %}
    ## He wishes for the Cloths of Heaven
    
    by W.B.Yeats
    
    > Had I the heavens’ embroidered cloths,
    
    > Enwrought with golden and silver light,
    
    > The blue and the dim and the dark cloths
    
    > of night and light and the half-light,
    
    > I would spread the cloths under your feet.
    
    > But I, being poor, have only my dreams;
    
    > I have spread my dreams under your feet,
    
    > Tread softly because you tread on my dreams.
    {% endfold %}

    image 1 image 2

  2. Set param

    {% fold summary="He wishes for the Cloths of Heaven", open=true, style="background: #fafafa;padding: 10px 20px;" %}
    by W.B.Yeats
    
    > Had I the heavens’ embroidered cloths,
    
    > Enwrought with golden and silver light,
    
    > The blue and the dim and the dark cloths
    
    > of night and light and the half-light,
    
    > I would spread the cloths under your feet.
    
    > But I, being poor, have only my dreams;
    
    > I have spread my dreams under your feet,
    
    > Tread softly because you tread on my dreams.
    {% endfold %}

    image 3

Demo

  1. Run the following command in shell:

    cd demo
    gitbook install
    gitbook serve --lrport 60032
  2. And then open http://localhost:4000 in your browser.