# kevzka/epubtoword architecture

> Architecture diagram of the GitHub repository kevzka/epubtoword, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kevzka/epubtoword
- Repository: https://github.com/kevzka/epubtoword

## Overview

This repository contains scripts for converting EPUB books to DOCX and converting selected DOCX files to PDF. The EPUB script parses the archive and book markup, builds a formatted Word document, and writes it; the PDF script converts DOCX to HTML and renders that HTML. The README is empty, and the EPUB excerpt omits some implementation details, so the graph shows only evidenced responsibilities and calls.

Main entry points: [`epubToWord.js`](https://github.com/kevzka/epubtoword/blob/main/epubToWord.js) (EPUB converter), [`wordToPdf.js`](https://github.com/kevzka/epubtoword/blob/main/wordToPdf.js) (PDF conversion runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_epub["EPUB to Word"]
  node_epub_converter["EPUB converter<br/>[epubToWord.js]"]
  node_epub_archive["EPUB archive"]
  node_epub_markup["Book markup parser"]
  node_docx_builder["DOCX builder<br/>[epubToWord.js]"]
end

subgraph group_pdf["Word to PDF"]
  node_pdf_runner["PDF conversion runner<br/>[wordToPdf.js]"]
  node_docx_html["DOCX to HTML<br/>[wordToPdf.js]"]
  node_html_renderer["HTML PDF renderer<br/>[wordToPdf.js]"]
end

node_user(("Operator"))
node_docx_output["DOCX file"]
node_pdf_output["PDF file"]

node_user -.->|"starts conversion"| node_epub_converter
node_epub_converter -->|"opens archive"| node_epub_archive
node_epub_converter -->|"parses book markup"| node_epub_markup
node_epub_converter -->|"builds document"| node_docx_builder
node_docx_builder -->|"writes DOCX"| node_docx_output
node_user -->|"runs script"| node_pdf_runner
node_pdf_runner -->|"converts DOCX"| node_docx_html
node_docx_html -->|"renders HTML"| node_html_renderer
node_html_renderer -->|"writes PDF"| node_pdf_output
node_pdf_runner -->|"reads selected files"| node_docx_output

click node_epub_converter "https://github.com/kevzka/epubtoword/blob/main/epubToWord.js"
click node_docx_builder "https://github.com/kevzka/epubtoword/blob/main/epubToWord.js"
click node_pdf_runner "https://github.com/kevzka/epubtoword/blob/main/wordToPdf.js"
click node_docx_html "https://github.com/kevzka/epubtoword/blob/main/wordToPdf.js"
click node_html_renderer "https://github.com/kevzka/epubtoword/blob/main/wordToPdf.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_epub_converter,node_epub_archive,node_epub_markup,node_docx_builder toneBlue
class node_pdf_runner,node_docx_html,node_html_renderer toneAmber
class node_user,node_docx_output,node_pdf_output toneIndigo
```

## Components

### EPUB to Word

- [EPUB converter](https://github.com/kevzka/epubtoword/blob/main/epubToWord.js): `epubToWord.js`
- **EPUB archive**
- **Book markup parser**
- [DOCX builder](https://github.com/kevzka/epubtoword/blob/main/epubToWord.js): `epubToWord.js`

### Word to PDF

- [PDF conversion runner](https://github.com/kevzka/epubtoword/blob/main/wordToPdf.js): `wordToPdf.js`
- [DOCX to HTML](https://github.com/kevzka/epubtoword/blob/main/wordToPdf.js): `wordToPdf.js`
- [HTML PDF renderer](https://github.com/kevzka/epubtoword/blob/main/wordToPdf.js): `wordToPdf.js`

### Other components

- **Operator**
- **DOCX file**
- **PDF file**

## Connections

- Operator → EPUB converter: starts conversion
- EPUB converter → EPUB archive: opens archive (evidence: `epubToWord.js`)
- EPUB converter → Book markup parser: parses book markup (evidence: `epubToWord.js`)
- EPUB converter → DOCX builder: builds document (evidence: `epubToWord.js`)
- DOCX builder → DOCX file: writes DOCX (evidence: `epubToWord.js`)
- Operator → PDF conversion runner: runs script (evidence: `wordToPdf.js`)
- PDF conversion runner → DOCX to HTML: converts DOCX (evidence: `wordToPdf.js`)
- DOCX to HTML → HTML PDF renderer: renders HTML (evidence: `wordToPdf.js`)
- HTML PDF renderer → PDF file: writes PDF (evidence: `wordToPdf.js`)
- PDF conversion runner → DOCX file: reads selected files (evidence: `wordToPdf.js`)
