The engine · formatter_v2

Every paragraph, classified.Every page, composed.

Traditional formatters look at font names. BookForge360 looks at intent — running each paragraph through a six-stage semantic pipeline before a single glyph hits the page.

§ 01 — The classifier

The dynamic semantic classifier.

Six stages, each falling through to the next if inconclusive. By the time the renderer sees a block, it has been evaluated against label patterns, Word styles, workbook heuristics, shape signals, sequence context, and colon-intro list runs.

25+ roles
Distinct block classifications
  1. 01
    Label pattern dispatch

    High-confidence regex table catches Chapter/Part labels (digits, Roman numerals, and spelled-out numbers 1-99), named callouts (RN Insight, Bedside Example), and front/back-matter markers.

  2. 02
    Word-style + length signals

    Heading 1-3 styles combined with a ≤12-word length ceiling classify short paragraphs as chapter titles or section headings — even when the label pattern misses.

  3. 03
    Workbook signal detection

    Reflection prompts, exercises, and generic callouts caught by lead-phrase heuristics — before falling through to body paragraph.

  4. 04
    Shape-based ad-hoc H3 promotion

    Short (2-8 words) title-case standalone paragraphs get promoted to SECTION_HEADING even when the source lacks any Word Heading styling.

  5. 05
    Sequence pass

    Neighbour context refines borderline classifications, catching TOC blocks, back-matter transitions, and stray label ambiguity.

  6. 06
    Auto-bullet promotion

    Body paragraphs ending in ':' followed by 2+ short single-sentence lines get promoted to BULLET_ITEM — 768 bullets promoted in a single 22-chapter manuscript run.

§ 02 — Typography spec

Classic Trade Standard.

  • 11pt body in Crimson Pro / Georgia serif — a balanced 1.4 line-height, fully justified.
  • 1.25em first-line indents on every body paragraph — dropped entirely after headings for a clean visual reset.
  • Widow/orphan protection keeps trailing lines from separating onto their own page.
  • 24pt bold chapter titles, centered with a forced page break — 16pt bold section headings with 12pt above / 6pt below.
Your Nervous System Is Stuck

Chapter 1

Why Your Symptoms Make Sense

This is how a masterfully formatted page looks. The first paragraph drops indent entirely after headings — a classic trade convention that gives readers a clean visual reset at every section break.

Every paragraph following has a 1.25em first-line indentation applied seamlessly by the compiler. Line height sits at a golden 1.4 ratio for optimal readability across print and screen.

After the callout, the body prose continues with its standard indent — the aside floats inside the reading flow without breaking rhythm.

§ 03 — Container callouts

High-visibility <aside> containers.

RN Insights, Bedside Examples, and any custom named callout wrap into styled aside blocks with soft grey backdrops and elegant left-border rules. Page-break-inside: avoid keeps them from splitting mid-container across page turns.

Guarded from splits

page-break-inside: avoid keeps every callout intact across page turns in the PDF export.

Portable across formats

The same aside renders as a Quote-styled paragraph in DOCX and a themed div in EPUB — one source, three formats.

Composable containment

Bullet lists, sub-headings, and inline images all render inside the callout body while staying inside the aside.