Git Product home page Git Product logo

gitbook-plugin-journal-summary's Introduction

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.

gitbook-plugin-journal-summary's People

Contributors

gamell avatar

Stargazers

 avatar  avatar

Watchers

 avatar

gitbook-plugin-journal-summary's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.