Skip to main content

Generate HTML word count reports from text and DOCX documents

Project description

Переплет (bookbinder)

Bundle multiple documents (.txt, .md, .docx) into a single, beautiful HTML viewer with hierarchical table of contents and smooth content switching.

Features

  • Multiple file types – Supports .txt, .md, and .docx
  • JSON manifest – Define document structure (chapters → files)
  • Single HTML output – Everything in one file (plus shared assets)
  • Hierarchical TOC – One entry per chapter, clean navigation
  • Smooth content switching – Animated transitions via JavaScript
  • Themes – Built-in theme toggle to switch color themes for site
  • Responsive design – Works on desktop and mobile
  • No URL hashing – Clean back button behavior
  • Customizable – Bring your own template, CSS, or JavaScript

Installation

pip install pereplyot

Usage

Basic usage

pereplyot manifest.json

Output is written to dist/portfolio.html.

With custom output directory

pereplyot manifest.json --output site/

Force overwrite

pereplyot manifest.json --force

With custom template

pereplyot manifest.json --template my-template.html

Manifest Format

Create a JSON file defining your document structure:

{
  "title": "My Portfolio",
  "description": "A collection of my work",
  "author": "Your Name",
  "chapters": [
    {
      "title": "Chapter 1: Introduction",
      "files": [
        {"path": "docs/intro.md", "name": "Getting Started"},
        {"path": "docs/background.txt", "name": "Background"},
        {"path": "docs/report.docx", "name": "Initial Report"}
      ]
    },
    {
      "title": "Chapter 2: Deep Dive",
      "files": [
        {"path": "docs/analysis.md", "name": "Data Analysis"},
        {"path": "docs/conclusions.txt", "name": "Conclusions"}
      ]
    }
  ]
}

Manifest Fields

Field Required Description
title Yes Document title (appears in header and browser tab)
description No Meta description for SEO
author No Author name (can be used in custom templates)
chapters Yes Array of chapters
chapters[].title Yes Chapter title (appears in TOC)
chapters[].files Yes Array of files in this chapter
files[].path Yes Path to document (relative to manifest location)
files[].name No Display name (falls back to filename)

Example manifest files

A collection of example manifest files and documents can be found in examples/ directory:

git clone https://github.com/bkuz114/pereplyot.git
pip inistall pereplyot
pereplyot examples/fishing_doc.json

File Types

Extension Conversion Output
.txt Plain text Wrapped in <p> tags
.md Markdown Converted to HTML via python-markdown
.docx Microsoft Word Converted via python-docx

Output Structure

dist/
├── portfolio.html          # Main HTML file
└── assets/
    ├── css/
    │   ├── styles.css      # Core styles
    │   └── themes.css      # Theme variables
    └── js/
        ├── scripts.js      # TOC interaction, content swapping
        └── sections.js     # Generated content dictionary

How It Works

  1. Parse manifest – Load JSON and build document structure
  2. Convert files – Each file converted to HTML string
  3. Group by chapter – Files in same chapter combined (with <hr> between)
  4. Generate TOC – Hierarchical navigation from document structure
  5. Write sections.js – Dictionary mapping chapter IDs to HTML content
  6. Write portfolio.html – Shell with TOC (content loaded dynamically)
  7. Click TOC – JavaScript swaps content with smooth animation

Customization

Custom Template

Create your own HTML template with these placeholders:

Placeholder Description
{{ title }} Document title from manifest
{{ description }} Meta description
{{ toc }} Generated table of contents
{{ asset_path_prefix }} Relative path to assets (e.g., assets/ or ../assets/)

Custom CSS/JS

Replace the default assets with your own:

pereplyot manifest.json --assets path/to/my/assets

Your assets directory should contain css/ and js/ subdirectories.

Development

Prerequisites

  • Python 3.9+
  • Git

Clone and install

git clone https://github.com/bkuz114/pereplyot.git
cd pereplyot
pip install -e .

Build distribution

./bin/build.sh

License

MIT License – see LICENSE file for details.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pereplyot-1.0.0.tar.gz (60.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pereplyot-1.0.0-py3-none-any.whl (60.8 kB view details)

Uploaded Python 3

File details

Details for the file pereplyot-1.0.0.tar.gz.

File metadata

  • Download URL: pereplyot-1.0.0.tar.gz
  • Upload date:
  • Size: 60.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for pereplyot-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b09ffc7c15067fb191b74373b8144686ea539208a1eecfd4170bf5c4db45c3e7
MD5 358525c924b9b98a3fed8148bcb2e6c6
BLAKE2b-256 35d982e6cec367f465fcc1f53b5805027be1e18e11a23c10e247922cead2a357

See more details on using hashes here.

File details

Details for the file pereplyot-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pereplyot-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 60.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for pereplyot-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cde61a7649ba30b54b48d25018eca0d2a88541e67fab805181173cbd3e4cdceb
MD5 1f4e7f48bdf4e6a691c5633ef87bffc0
BLAKE2b-256 0b4d8caa689e5ba0187e94f8e52ef9680013c5df81364a2e2ae49ea1afe7ad23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page