Editing
You can change a book's text without leaving Typoteka.
Opening the editor
Right-click on the text of a section in the book. For the section, and for the chapter, the menu has two entries:
- Edit section "Title": opens the visual editor on the section, from its heading to the end of the section.
- Edit section "Title" as Markdown: opens the Markdown editor on the same text.
- Edit chapter "Title" and Edit chapter "Title" as Markdown: the same for the whole chapter. They are offered only when the section is not itself the chapter.
Inside a ::: chapter block, only the chapter can be edited.
The table of contents, the book's title and blank pages are made by Typoteka from the text, so there is nothing to edit there and the menu does not offer it.
Both editors open over the book. Done applies your changes and closes it: the book is laid out again from the first page, and the view moves to the section you edited as soon as its page is ready. Cancel closes it without changing anything, and asks first if there are changes. Escape also cancels.
In the Markdown editor the text stays Markdown. The bar above it writes the syntax for you around the selection, or around the word under the cursor: bold (⌘B or Ctrl+B), italic (⌘I), code (⌘E), heading and subheading (##, ###), bulleted and numbered lists (⌘⇧8, ⌘⇧7), quote, and link (⌘K, with the address selected to type over). Pressing a button again on text that already has it takes it off. The syntax marks and HTML comments (<!-- … -->) are shown fainter than the text.
The view moves to the edited section through a handler you can turn off: Project Settings → Advanced → Go to the edited section, on by default.
Writing visually
The visual editor shows the section as the book shows it: the book's fonts, headings and boxes, and the style's own blocks, in one column, with the images in place. You type in it as in any text editor.
- The toolbar and the shortcuts are the ones of the Markdown editor (bold, italic, code, headings, lists, quote, link), applied as formatting instead of as syntax marks. Spaces you type are plain spaces, also where the style keeps line breaks; elsewhere a no-break space you type on purpose (Option+Space on a Mac) stays one.
- Addresses you type (
https://…,www.…, an e-mail address) are written as you typed them, and the book shows them as links. - The line breaks you wrote stay where they are. Where the style keeps line breaks (a stat block, or a spell in some styles), they show as lines.
- Quotes and dashes show as you typed them; the book is the one that turns them into curly quotes and dashes.
- Tables, raw HTML, page and column breaks, and footnote definitions are drawn as in the book, but cannot be edited in place. Right-click one and choose Edit ... as Markdown to open a small Markdown editor on just that piece; its Done puts it back in the visual editor.
- What some styles take out of the text into the page margins, such as AD&D 2nd Ed's chapter icon, and a chapter title some styles hide because it only feeds the running head, show in a small grey strip labelled Page head, where they are in the text. You type in the title there as in any heading; an image there is a small thumbnail, with its usual right-click entries. The book is not affected: on the pages they stay in the margins.
- Done and Cancel work as in the Markdown editor. With the panel or the small Markdown editor open, they close it first, and ask if it has changes you did not apply. Escape closes the right-click menu, the panel or the small editor, whichever is open; with none open, it cancels. Cancel asks whenever you changed something, also when the only change is one that can't be written (see below).
Only what you change is rewritten in the file; the rest keeps its exact text. That holds inside a paragraph you edit too: what you did not touch there stays as it was written, such as ©, a line break made with two spaces, a backslash before a character, the quotes around a link's title, or a quoted line written without its >.
Sometimes what you type would not read back as what the editor shows: text that looks like Markdown syntax, such as [word]{.class}, for example. For that paragraph or heading the original text is kept, and the editor lists it in a note; that change is lost, and Done asks before applying the rest. A paragraph you added, or the second half of one you split with Enter, has no original text: it is written as plain text, without its formatting. For the same reason, bold, italic, code and link do nothing over part of a bracketed span.
Right-click in the visual editor for:
- Edit image..., Edit table..., Edit block...: the panel described in One table or image, applied inside the editor. The book changes only when you press Done.
- Edit ... as Markdown, as above.
- Remove the block around it: takes off the
:::lines around the piece and keeps what was inside. - Wrap in a block: puts the selected text inside one of the style's blocks. The menu lists the blocks the style marks for text (
"for": ["text"]in its style.json).
When a section cannot be shown visually, the Markdown editor opens instead and says why.
One table or image
Right-click a table or an image (or its caption) in the book. The menu starts with two entries for it, before the section and the chapter:
Edit table… / Edit image… opens a panel:
- Placement: in the flow, across the columns, two or three of them at the top or the foot of the page (offered when there are enough columns), across the text block, and for an image, wrapped left or right, or a page of its own.
- Edges, for an image: on each side, the text block, the trim or the bleed (see To the edge of the page).
- From the style: the blocks the style offers for tables or images, such as AD&D 2nd Ed's tinted and striped tables.
- Other: keep together, and any other class the block has, kept unless you untick it.
Apply writes the classes on the
:::line around it, adding the block when there is none and removing it when no class is left; the text inside is not touched. The book is laid out again, and the change is an unsaved change like any other. Cancel or Escape closes the panel without changing anything.Edit table as Markdown / Edit image as Markdown opens the editor on its lines only: the
:::block around it, or the table or image and its title when it has none.
Unsaved changes
The status bar shows N unsaved changes while there are edits that are not saved, each run of changed lines counting as one. Click it to see them in the book: every changed paragraph, list item, table row or box is tinted for a few seconds, and the book scrolls to the first change. Each further click goes on to the next one, and the label says which (Unsaved change 2 of 3). Where text was only deleted, a dashed line labelled Removed marks the place, and the label adds text removed. The changes are shown once the book has finished laying out after the last edit.
When the book's settings changed too, the label adds + settings; when only they changed, it reads Unsaved settings, and clicking it opens Project Settings. View preferences such as the zoom do not count.
The edits are kept in your browser as a draft. If you close the tab or reload, the next time you open the same book Typoteka offers to Recover stored changes or Discard stored changes. If the draft was made on an older version of the repository, it says so.
Saving
File → Save (⌘S or Ctrl+S):
- A book from GitHub: every changed file goes in one commit to the branch the book was loaded from.
typoteka.jsonis included only when the book's settings changed; view preferences such as the zoom do not count. The Save tab of the Source panel lists the files and has a commit message field, which starts as "Edit" followed by the file names. - If the branch moved since the book was loaded, nothing is overwritten: your changes stay in the editor, and Download a copy is offered.
- A book loaded from a tag or a commit cannot be saved to GitHub, only a book loaded from a branch.
- A book opened from a folder or a zip: the project is downloaded as a zip with your changes.
typoteka.jsonis byte-identical unless the settings changed. - A single Markdown file is downloaded as itself.
Typoteka never writes into your folders.