Add epubcheck target for local EPUB validation (#9)

Backported from em_book's CI. Adds a 'make epubcheck' target that builds
the EPUB (via its dependency) and validates it with EPUBCheck, so authors
can catch EPUB issues locally before publishing.

- New epubcheck target depending on the EPUB path
- Document it in the README
- Add .PHONY declarations

Co-authored-by: Dunya Kirkali <exedev@writting.exe.xyz>
Co-authored-by: Shelley <shelley@exe.dev>
This commit is contained in:
Dunya Kirkali
2026-08-08 22:05:23 +02:00
committed by GitHub
parent 0af9d53b0f
commit 59ff4fc3a3
2 changed files with 15 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ EPUB_PATH := output/$(EPUB_NAME)
ASCIIDOC_FLAGS = \ ASCIIDOC_FLAGS = \
--doctype book --doctype book
.PHONY: all count clean lint epubcheck
all: $(PDF_PATH) $(EPUB_PATH) all: $(PDF_PATH) $(EPUB_PATH)
$(PDF_PATH): $(ASCIIDOC_FILES) $(FIGURES) Makefile metadata.yaml | output $(PDF_PATH): $(ASCIIDOC_FILES) $(FIGURES) Makefile metadata.yaml | output
@@ -30,6 +32,9 @@ $(EPUB_PATH): $(ASCIIDOC_FILES) $(FIGURES) Makefile metadata.yaml | output
count: count:
wc -w source/* wc -w source/*
epubcheck: $(EPUB_PATH)
epubcheck $(EPUB_PATH)
output: output:
mkdir output mkdir output

View File

@@ -60,6 +60,16 @@ make output/book.epub
make count make count
``` ```
### Validate EPUB
letterpress can validate the generated EPUB with [EPUBCheck](https://www.w3.org/publishing/epubcheck/). Once you've installed EPUBCheck on your machine you can run it with:
```bash
make epubcheck
```
This builds the EPUB (if needed) and then validates it.
### Clean ### Clean
In order to remove the generated files you can run: In order to remove the generated files you can run: