Decisions
Each design or technical decision, why it was made, and when. Newest last.
From the blog script (October 2026)
auto-print started as one script in the author's Dropbox-synced blog folder. These decisions were made there.
- Read manuscripts as
gfm. It matches how GitHub, GitLab and the VS Code preview show the files. A single line break is a soft break, so a manuscript with one sentence per line gives the same book as one with one line per paragraph. This was checked on three full books with pandoc 3.6.1: the epub, html and docx text was identical. - Publish only one section of a manuscript (
## Writingby default). Manuscripts keep notes, spelling lists and cut scenes next to the story, and these must never reach a reader. - The source files are never changed. The build reads them and writes only to the output folder.
- Collections are an index file with links, not a list of files in the config. The index file is where the author already keeps the story order, so the order lives in one place. A link in an HTML comment is skipped, which is how a story that is not ready is kept out.
- A story's opening text moves below its title in a collection. Otherwise each story's content warning would land at the end of the previous story.
- Extra pages are sections of the source file, named in the config. The author did not want a separate file per page. Naming them in the config, instead of recognising fixed names, means a section is never published by accident.
- The shallowest heading wins when a name is used at several levels. A real case: an
## Infosection held### Charactersnotes with spoilers, next to a reader-facing## Characterspage. Two headings with the same name at the same level stop the build, because there is no safe way to choose. - The epub's flowing layout is built in the markdown, not with pandoc's
--shift-heading-level-by. Extra pages need their own epub files (level 1 headings) while the story stays in one file. Doing the shift in the markdown, under a level 1 heading with the book title, gave byte-identical epub files to pandoc's own shift for books without extra pages. - Only pandoc's known epub roles are used. pandoc puts
dedication,copyright-pageandprefacein the front matter andappendixin the back matter. An unknown role is treated as story text, so front pages default toprefaceand back pages toappendix. - pandoc extensions
attributes,raw_attributeandfenced_divsare on. The assembled markdown uses them to mark the extra pages, the page breaks and the dedication. They were turned on only after checking that none of the existing manuscripts contained{or a line starting with:::, and that the books came out identical. - Page breaks are written per format: a raw Word page break in the docx, a
page-breakdiv in the html for the pdf, and nothing in the epub, where a new file is a new page.
As a package (2026-10-24)
- No runtime dependencies. Only Node's built-in modules. The external tools (pandoc, a browser, Kindle Previewer) are run as commands. Fewer dependencies means less upkeep.
- TypeScript that Node can run directly (
erasableSyntaxOnly,.tsimports). The author's blog runs the source from a clone withnode src/cli.ts, so there is no build step to forget. Installed packages live innode_modules, where Node does not run.tsfiles, so the published package runsdist/, compiled bytsc(rewriteRelativeImportExtensions). - Every path in the config file is relative to the config file's folder. One rule for
source,coverandoutDir. authorhas no built-in default. The blog script defaulted to its own author, which would be wrong for anyone else.- The docx dedication style comes from a reference doc (
assets/reference.docx). A Word paragraph style is the only way pandoc can center a paragraph in a docx. The file is pandoc's default template plus one style, made byscripts/make-reference-docx.sh. For a book without a dedication, the only change in the docx is one unused style. - Tests use Node's built-in test runner, again to avoid dependencies. The pandoc tests check pandoc's syntax tree of the assembled markdown, and skip themselves when pandoc is not installed.