Skip to main content

Segment-based book manuscript editor with git integration

Project description

Writer-Reader

Segment-based book manuscript editor with git integration.

Version Python License

Overview

Writer-Reader breaks book chapters into individual markdown segments for granular editing, with built-in git integration for tracking changes.

Features:

  • ๐Ÿ“– Segment chapters into editable markdown files
  • โœ๏ธ In-browser editing with live preview
  • ๐Ÿ”€ Git integration (status, diff, commit, push)
  • ๐Ÿ“ Convention-based file organization
  • ๐Ÿ”„ Assemble segments back into chapters

Installation

pip install writer-reader

Or install from source:

git clone https://github.com/bobmatnyc/writer-reader.git
cd writer-reader
pip install -e .

Quick Start

1. Initialize a new project

writer-reader init my-book --title "My Book" --author "My Name"
cd my-book

2. Add your chapters

Place markdown files in chapters/:

my-book/
โ”œโ”€โ”€ chapters/
โ”‚   โ”œโ”€โ”€ chapter-01-introduction.md
โ”‚   โ”œโ”€โ”€ chapter-02-the-beginning.md
โ”‚   โ””โ”€โ”€ ...

3. Segment chapters

writer-reader segment

Creates:

my-book/
โ”œโ”€โ”€ segments/
โ”‚   โ”œโ”€โ”€ ch01-introduction/
โ”‚   โ”‚   โ”œโ”€โ”€ _meta.yaml
โ”‚   โ”‚   โ”œโ”€โ”€ 01-introduction.md
โ”‚   โ”‚   โ”œโ”€โ”€ 02-the-beginning.md
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ””โ”€โ”€ _index.yaml

4. Start the editor

writer-reader serve

Open http://localhost:5555

File Convention

segments/
โ”œโ”€โ”€ ch01-chapter-title/
โ”‚   โ”œโ”€โ”€ _meta.yaml           # Chapter metadata
โ”‚   โ”œโ”€โ”€ 01-opening.md        # First segment
โ”‚   โ”œโ”€โ”€ 02-section-name.md   # Named section
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ ch02-next-chapter/
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ _index.yaml              # Master index

Segment Types

  • chapter-title: The # Chapter N: Title heading
  • section: ## Section Name headers
  • prose: Content between --- dividers

Metadata Format

_meta.yaml:

chapter: 1
title: The Beginning
source_file: chapter-01-the-beginning.md
segments:
  - file: 01-the-beginning.md
    title: "The Beginning"
    type: chapter-title
    index: 1
  - file: 02-first-section.md
    title: "First Section"
    type: section
    index: 2

CLI Commands

Command Description
writer-reader init <dir> Initialize a new manuscript project
writer-reader segment [dir] Segment chapters into individual files
writer-reader serve Start the editor server
writer-reader assemble [dir] Assemble segments back into chapters

Options

# Serve on different port
writer-reader serve --port 8080

# Segment with force overwrite
writer-reader segment --force

# Assemble specific chapter
writer-reader assemble --chapter 5

API Endpoints

Endpoint Method Description
/api/index GET Get all chapters/segments
/api/chapter/<num> GET Get chapter metadata
/api/segment/<path> GET Read segment content
/api/segment/<path> PUT Write segment content
/api/git/status GET Git status
/api/git/diff GET Show uncommitted changes
/api/git/add POST Stage files
/api/git/commit POST Commit with message
/api/git/push POST Push to remote
/api/assemble/<num> GET Preview assembled chapter
/api/assemble/<num> POST Save assembled chapter

Development

# Clone repository
git clone https://github.com/bobmatnyc/writer-reader.git
cd writer-reader

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/
ruff check src/ --fix

Version History

  • 0.1.0 - Initial release
    • Chapter segmentation
    • In-browser editing
    • Git integration
    • CLI commands

License

MIT License - see LICENSE for details.

Author

Bob Matsuoka (@bobmatnyc)

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

writer_reader-0.1.1.tar.gz (584.6 kB view details)

Uploaded Source

Built Distribution

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

writer_reader-0.1.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file writer_reader-0.1.1.tar.gz.

File metadata

  • Download URL: writer_reader-0.1.1.tar.gz
  • Upload date:
  • Size: 584.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for writer_reader-0.1.1.tar.gz
Algorithm Hash digest
SHA256 11707757172ae2b9a6bd0f1f807bc1e58fc49a7a039576213ba7dd1c0b4315da
MD5 755afa8232e8102887f907c0dd804a11
BLAKE2b-256 999b92d906eb8fa06f6ad0928403e39500120cc69110835d865f3ccdc91cec3d

See more details on using hashes here.

File details

Details for the file writer_reader-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: writer_reader-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for writer_reader-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca2e15e7cb7620e809a38c0831bc0b36c2331343a70c4a50cb9ca515c4cdc166
MD5 bf2730c0634dc11767560c48590671b3
BLAKE2b-256 da73d49a3f52ad12d3d62aa3e0b51ed8de2659c72cbd861d7ec579db14bef62b

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