
<FormatHero
  title="Books written in Markdown, read on the web."
  format="book"
  description="One manuscript gives a printable PDF, an EPUB 3 file and a web edition."
  actions={[
    { label: "Open a book", href: "/gallery" },
  ]}
>
  <FormatVignette format="book" />
</FormatHero>

**Récit book** puts a book together from Markdown files: an entry that lists the chapters, one file
per chapter beside it. Chapters, figures and notes are numbered, cross-references and the index are
resolved once, and the same book is read on the web, exported to EPUB 3 and, with the print chain,
to PDF.

<PageSection tone="plain" label="A chapter">

## A chapter, read on the web

The chapter below comes from
[`examples/book-novella`](https://github.com/vguerand/recit/tree/main/examples/book-novella); the
whole book is under [Read](/book/novella), and its source under [One source](/book/one-source).

<StoryEmbed slug="book/novella" format="book" chapter="lorem" />

</PageSection>

<PageSection tone="surface" label="The book format">

## The book format

<FeatureGrid cols={3}>
  <FeatureCard title="One file per chapter" description="An entry lists the chapters in reading order; each chapter is a story of its own, with its sections." mark="book" site="docs" href="/formats/book/overview" />
  <FeatureCard title="Numbered once" description="Chapters, figures (Figure 2.3) and notes are numbered by the book, the same in every output." mark="book" site="docs" href="/formats/book/directives" />
  <FeatureCard title="Cross-references" description="`:ref[fig-map]` prints the label of its target; an unknown id is an error with its file and line." mark="book" site="docs" href="/formats/book/directives" />
  <FeatureCard title="A web edition" description="One page per chapter, the table of contents as the sidebar, notes at the end of the chapter." mark="book" href="/book/novella" />
  <FeatureCard title="EPUB 3" description="`recit export --to epub` writes a deterministic EPUB, checked by epubcheck in the tests." mark="book" href="/book/one-source" />
  <FeatureCard title="Typed JSON twin" description="The entry and every chapter have a typed JSON form, checked by the schema and convertible both ways." mark="book" site="docs" href="/formats/book/overview" />
</FeatureGrid>

</PageSection>

<PageSection tone="tint" label="Start a book">

## Start a book

<TutorialSteps>
  <TutorialStep title="Create a book" duration="10 s">
    `recit init --format book` writes `book.md` and two Lorem chapters beside it.

    ```bash
    npx recit init book.md --format book
    ```

  </TutorialStep>
  <TutorialStep title="Read it with live reload" duration="1 min">
    `recit dev` serves the web edition and reloads it when the entry, a chapter or an image changes.

    ```bash
    npx recit dev book.md
    ```

  </TutorialStep>
  <TutorialStep title="Check, build and export" duration="30 s">
    `recit validate` assembles the whole book; `recit build` writes the web edition, and
    `recit export --to epub` the EPUB.

    ```bash
    npx recit validate book.md && npx recit build book.md && npx recit export --to epub book.md
    ```

  </TutorialStep>
</TutorialSteps>

The full syntax is specified on [docs.recit.dev](https://docs.recit.dev/formats/book/overview).

</PageSection>
