Skip to content

Name Tidying

Retro-Jack edited this page Aug 6, 2026 · 1 revision

Name Tidying

Controlled by TIDY_NAMES (default true). Set it false to leave every name exactly as pdf2epub wrote it.

What it does

Two passes over each result, in order:

  1. Separator cleanup — runs of ., _ and - become single spaces, runs of whitespace collapse, and leading/trailing whitespace goes.
  2. Title case — the first letter of each word is capitalised.
some_document-name.md   ->   Some Document Name.md
THE.QUICK.BROWN.FOX     ->   THE QUICK BROWN FOX
jack's_book             ->   Jack's Book

Title case only touches a lowercase letter that isn't preceded by a word character or an apostrophe. That's what keeps THE from becoming The, acronyms intact, and jack's from turning into Jack'S.

What it touches

For each result folder: the top-level files first, then the folder itself.

Anything inside images/ is deliberately left alone. The generated markdown links to those files by their original names — renaming them would break every image in the document.

Safety

  • A rename that would clobber an existing file or folder is refused and logged, not forced.
  • A failed regex logs the failure and leaves the name untouched rather than writing a corrupted one.
  • Both cases increment the Rename errors counter in the final report.

The logs/ folder is excluded from the pass.

Clone this wiki locally