Skip to content

M24 — Manuscript export (EPUB / PDF) #49

Description

@julia-shtal

Context. The .md backup (M7) is a write-only safety copy, not meant for
sharing. This is a real "compile for a reader" export, built directly from the
JSON canon — so, unlike the .md backup, paragraph alignment is not lost.

Scope

  1. New "Экспортировать рукопись" action (Story info view), compiling all
    chapters (in chapterOrder) into one document.
  2. PDF: reuse the existing ProseMirror → HTML/text serialization approach
    from ../src/main/markdown.ts as the base extraction of text + marks, map to
    a standard-manuscript-format HTML template (readable serif font, double
    spacing, page header with title/author/page number, scene dividers
    centered), then render via Electron's webContents.printToPDF() from an
    offscreen view.
  3. EPUB: needs a real EPUB-writing dependency (e.g. epub-gen or similar —
    Julia's call on which). Chapter-per-file, reflowable, no cover image in v1.
  4. Footnotes: render as endnotes per chapter (or a numbered list at chapter
    end) rather than inline markers, for both formats.
  5. Check whether StoryMeta/settings already carries an author name; if not,
    add the field (Story info view) since manuscript format needs it in the header.

Out of scope v1: cover image upload, multiple format presets (e.g. Shunn
vs. house style) — ship one sensible default per format, defer presets.

Acceptance criteria

  • Exported PDF/EPUB reflects paragraph alignment and all marks
    (bold/italic/strike), scene dividers, and footnotes correctly.
  • Export reads only from the JSON canon, never from the .md backup.
  • A story with zero chapters or empty chapters doesn't crash export —
    produces an (expectedly thin) valid file or a clear "нечего
    экспортировать" message.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions