Skip to content

Editions ​

Every build writes to dist/<config name>/ under the current folder (dist/book/ for book.json), or to --out <dir>:

FileBuilt by
<output_name>-170x240.pdfbuild pdf
<output_name>-170x240-printed.pdfbuild pdf --printed
<output_name>.epubbuild epub
web/build web, serve
QA-REPORT.md, qa-pages/qa
src/working files kept for checking

PDF ​

console
$ md2book build pdf
$ md2book build pdf --printed

The 170 × 240 mm book, in this order: cover, title page, copyright page, contents with page numbers, then the chapters, with running headers and page numbers.

  • Page 1 is the first page of chapter one. Myanmar books number pages in Myanmar digits (chapter_digits).
  • recto_chapter_start: true starts every chapter on a right-hand page; running_headers: false removes the page headers.
  • Burmese lines break between syllables, never inside one.
  • A section heading never sits alone at the foot of a page; it moves to the next page with its first lines.
  • An end_image becomes the last page once the chapter named by end_image_after exists.

Printed edition. --printed writes the print-shop interior, <output_name>-170x240-printed.pdf: no cover page (the title page is page 1), no colour and no dark fills, so code and terminal blocks print cleanly in black and white.

The HTML the PDF is typeset from is kept in src/book-print.html (or src/book-printed.html) for checking.

EPUB ​

console
$ md2book build epub

A reflowable EPUB 3 of every chapter, <output_name>.epub, with the book's fonts embedded, the cover, a title and copyright page, and the contents. An end_image is the last document once the chapter named by end_image_after exists. The unpacked files stay in src/epub/.

Web edition ​

console
$ md2book build web
$ md2book serve --port 8000

A static site of the chapters listed in web_published_chapters; other chapter files are never read, so unpublished drafts never reach the site. It reads like a real book: it opens from a closed cover, pages turn with a curled sheet, and wide screens show a two-page spread.

Readers get a toolbar with the contents, search, text size, bookmarks and fullscreen, and these keys:

KeyAction
← →previous and next page
+ -larger and smaller text (code blocks keep their size)
Ffullscreen

The reading position, bookmarks and text size are remembered in the browser.

The site is written to web/: index.html, one page per chapter in chapters/, 404.html, and its styles, fonts and images. Upload the folder as it is; it must be served from the root of its domain.

KeyEffect
web_urlcanonical and share links
descriptionthe page description (default subtitle, then title)
faviconan SVG icon
back_coverthe back cover; without it a plain one is generated with Chromium

serve builds the site, then serves it at http://127.0.0.1:8000/ (--port changes the port) until Ctrl+C.

QA report ​

console
$ md2book qa
$ md2book qa --printed

QA-REPORT.md is a checklist to read before publishing. qa reports problems and never changes your files. It covers:

  • Manuscript: chapter count and order, code includes, word and character counts, and a table of chapters with their sections.
  • Unicode and Burmese text: text that is not NFC-normalized, replacement characters, zero-width and no-break spaces, BOMs, control characters, doubled vowel or medial signs, doubled punctuation, a space before ။ or ၊, double spaces, repeated words and HTML tags, with file and line.
  • Typeface coverage: which characters each font draws, and any character none of the book's fonts cover.
  • PDF (when built): page facts and checks, with sample pages rendered to qa-pages/. --printed checks the printed PDF.
  • EPUB (when built): reflowable layout, embedded fonts, chapter text identical to the manuscript, structure, and the epubcheck result when it is on your PATH.
  • Metadata placeholders: book fields that still contain PLACEHOLDER.
  • Known layout limitations and a section for your own review notes.

qa checks the PDF and EPUB already in the output folder; run the builds first, or use build all, which builds everything and then writes the report.

Released under the MIT Licence.