Skip to content

Hanthebot/mdBookShelf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdBookShelf

A wrapper to grab multiple mdBook together, and serve them altogether on a static site.

Working demo

Usage

Structure

This repository

.
├── covers         # directory where covers are stored
├── src
│   ├── cover.png  # default cover for your books
│   ├── data.js    # data wrapped by `manager.py`
│   ├── data.json  # CONFIGURATION where you specify list of books and their directory
│   ├── script.js  # JS for formatting the page
│   └── ...
├── index.html     # Homepage / Bookshelf
├── manager.py     # Manager to clear / export / serve books
└── ...

src/data.json

{
    "title": "Bookshelf",
    "books": {
        "book_code_1": {
            "title": "Awesome Title 1", 
            "path": "absolute_dir_to_mdbook/book"
        },
        "book_code_2": {
            "title": "Awesome Title 2", 
            "path": "absolute_dir_to_mdbook2/book"
        }
    }
}

Book directory

absolute_dir_to_mdbook
├── cover.png          # Book cover, automatically generated if needed
├── book
│   ├── index.html     # Home page for the book
│   └── ...
└── ...

Commands

  1. Clearing all subdirectories
    python manager.py clear
    • deletes / unlinks all subdirectories except src
    • this operation is done before serve and export command as well
    • ⚠️don't leave any valuable files in subdirectories!
  2. Serving mdBooks
    python manager.py serve
    • creates junction (mklink /J) to book directory
    • all book data can be accessed from index.html
  3. Exporting mdBooks
    python manager.py export
    • copies all books into subdirectory
    • modifies path from data.js accordingly
    • this folder can now be uploaded online for perfectly static service

Remarks

  • While it was designed for mdBook, it can serve as a bookshelf for any con
  • For the spirit of mdBook, manager.py will hopefully be rewritten in Rust.
  • Features to add
    • editing data.json through manager.py
      • adding new books
      • editing book information
      • deleting books
    • Some customization option (e.g. title, theme change) for index.html
  • I'm open for collaboration || suggestions

Thanks to

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published