Files
hello-algo/epub/README.md
T
O 091afd38b4 add epub generator (#1831)
* add epub generator

* improve parser, keep images

* check epub after generate

* fix render math content error in block

* render \dots as ...

* render \lfoor and \rfloor

* use monospaced font to render code block

* render code block with syntax highlight

* adjust title render

* fix render LaTeX

* fix '!!! abstract' render

* render code block in flow

* include whole class when not specifiy function

* command line to build other language

* update README

* fix process python code example

* support build en, ja and zh-hant

* add '--all' option to build all version

* use branch docs to build epub

* fix title and toc render

* build epub file with name like 'hello-algo_{zh}_{cpp}.epub

* fix render LaTeX

* optimize style

* use math font

* fix extract code block

* add border for code block

* fix python code style

* fix page break

* try git pull first when build epub

* ajust title level of chapter section

* Update epub styles

* Update epub styles

* Update convers and fonts.

* Convert code comments and README into English.

* Update the output dir.

* Add code reviewers on the cover.

* Support multi language for the reviewer names.

* Update .gitignore

---------

Co-authored-by: krahets <krahets@163.com>
2025-12-30 08:23:31 +08:00

59 lines
1.7 KiB
Markdown

# Hello Algorithm EPUB Converter
Convert [Hello Algorithm](https://github.com/krahets/hello-algo) Markdown documentation to EPUB e-books.
## Installation
```bash
npm install
```
## Usage
### Basic Usage
```bash
# Build Chinese version with C++ code (default)
npm run build
# Build with specific programming language
npm run build -- -l python
# Build Traditional Chinese version
npm run build -- -d zh-hant -l python -o hello-algo-zh-hant-python.epub
# Build English version
npm run build -- -d en -l python -o hello-algo-en-python.epub
# Build Japanese version
npm run build -- -d ja -l cpp -o hello-algo-ja-cpp.epub
# Build all combinations
npm run build -- --all --release-version 1.2.0
```
### Command Line Parameters
| Parameter | Short | Description | Default |
|-----------|-------|-------------|---------|
| `--doc-language` | `-d` | Document language (zh, zh-hant, en, ja) | `zh` |
| `--output` | `-o` | Output EPUB file path | `./hello-algo.epub` |
| `--language` | `-l` | Programming language | `cpp` |
| `--all` | `-a` | Build all combinations | - |
| `--release-version` | - | Version number for output filename | `1.0.0` |
| `--validate` | - | Enable content integrity validation | `false` |
| `--help` | `-h` | Show help | - |
| `--version` | `-V` | Show version | - |
### Supported Languages
**Document Languages:**
- `zh` - Simplified Chinese (all programming languages)
- `zh-hant` - Traditional Chinese (all programming languages)
- `en` - English (cpp, java, python only)
- `ja` - Japanese (cpp, java, python only)
**Programming Languages:**
- Supported by all document languages: `cpp`, `python`, `java`
- Supported by Chinese versions only: `csharp`, `go`, `swift`, `javascript`, `typescript`, `dart`, `rust`, `c`, `kotlin`, `ruby`, `zig`