gitbook-plugin-journal-summary
Plugin to generate gitbook's summary file for journal-style entries
Last updated 3 years ago by gamell .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gitbook-plugin-journal-summary 
SYNC missed versions from official npm registry.

gitbook-plugin-journal-summary

Build Status Coverage Status Dependencies Status npm version

This is a Gitbook plugin automatically generates your summary file(s) for your journal entries, effectively allowing you to use gitbook to compile your journal. It will automatically generate the SUMMARY.md and, optionally, intermediate summary files.

Warning

This plugin will overwrite your SUMMARY.md file, if any. This plugin is meant to be used solely as a journaling helper so it's not a good idea to use it in a project where you want to be able to edit the SUMMARY.md file manually.

Setup

Add this to your book.json:


{
  "plugins": ["journal-summary"]
}

Then run gitbook build

If you run gitbook serve directly it might not correctly pickup the newly generated summary files, so I recommend running gitbook build first

Usage

This plugin expects your Markdown Journal Entries to be named in this pattern: YYYY-MM-DD.md (e.g. 2017-12-29). It does not matter what folders or how many level deep you put your Markdown files. The plugin will find all the Markdown files that match the date format, build a tree with levels for Year, Month, and the individual entries as leafs. It will then output that in the correct format to the SUMMARY.md file.

For example, even with this messy (or "wrong") folder structure:

|
|- 2017-09-10.md
|
 \- 2017
|    \- 10
|        |- 2017-10-01.md
|  
 \- 2016
     |- 2016-02-28.md
     |- 2017-10-02.md
     \- 09
        |- 2016-09-01.md

The plugin will parse only the filenames, regardless of what folder the file is in, generating the correct working tree:

(root)
  |
   \_ 2016
  |    \_ February
  |   |      \_ 28th
  |    \_ September   
  |          \_ 1st  
   \_ 2017  
       \_ September   
      |     \_ 10th
       \_ October
            \_ 1st
           |
            \_ 2nd


Which will generate the following SUMMARY.md file (assuming generateAll = true):

  # Book Title

  - [2016](summaries/2016.md)
    - [February](summaries/2016-February.md)
      - [28th](/2016/2016-02-28)
    - [September](summaries/2016-September.md)
      - [1st](/2016/09/2016-09-01.md)
  - [2017](summaries/2017.md)
    - [September](summaries/2017-September.md)
      - [10th](2017-09-10.md)
    - [October](/summaries/2017-October)
      - [1st](/2017/10/2017-10-01.md)
      - [2nd](/2016/2017-10-02.md)

Configuration

Optionally, you can set the generateAll option to true if you want the plugin to also generate intermediate summary files for Year and Month levels, i.e. if you want the Year and Month levels to be clickable and to contain a summary of their contents. That option is to false by default. To set that option to true, add the following in your book.json file:

  "pluginsConfig": {
    "journal": {
      "generateAll": true
    }
  }

An example of a complete book.json file could look like this:

{
    "title": "Test Book",
    "plugins": ["journal-summary"],
    "pluginsConfig": {
      "journal": {
        "generateAll": true
      }
    }
}

Credit

Initially based on julianxhokaxhiu's gitbook plugin.

Current Tags

  • 0.0.3                                ...           latest (3 years ago)

3 Versions

  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |