# Vivlio New in 0.18.3: Japanese books preserve ordinary line breaks by default. Multiline comments, extra breaks at the start of callouts, and Japanese indentation after line breaks are also fixed. [Release notes and migration](docs/releases/0.18.3.md) **English** | [日本語](README.ja.md) Typeset Obsidian notes with [Vivliostyle](https://vivliostyle.org/) — CSS paged media, Japanese vertical writing, ruby and emphasis dots — with a live preview, and export to PDF and EPUB. Desktop only (`isDesktopOnly: true`). Nothing is downloaded on first run: the typesetting engine ships in the plugin and the PDF is printed by the Chromium Obsidian already runs. Implements [docs/SPEC.md](docs/SPEC.md). A full user manual in Japanese starts at [manual/](manual/00_vivlio_plugin_manual.md) — the settings tab, `vivlio.yaml`, writing, themes of your own, and troubleshooting.  *The note on the left, the page on the right. The preview uses the same engine and the same stylesheet the PDF will.* One thing the preview cannot do on its own: the page numbers on a contents page read `??` until every page has been laid out, because the number comes from `target-counter`, which has nothing to count against a page that has not been composed yet. PDF export composes the whole book and resolves the numbers; reflowable EPUB output hides contents-page numbers. To see the real numbers on screen, turn on **Render every page up front** in the settings — the preview then takes longer to appear and is right from the first frame. ## What it does The [manual sample](sample/manual/index.md) exercises the updated `manual` theme with four Japanese chapters, two schematic figures, settings, callouts, code, cross-note figure references and a 36-row checklist. See the [setup and verification notes](sample/manual-README.md). | | | |---|---| | **Preview** | A pane showing the real page composition — the same engine and stylesheet the PDF will use. Vertical writing, hanging punctuation and Japanese/Latin spacing included, none of which Obsidian's own PDF export can produce. | | **A book is one note or many** | One note is a book on its own. Point at a folder and the notes directly in it are the book; point at a table-of-contents note and the notes it links to are. | | **Obsidian syntax** | Embeds, wikilinks, callouts, task lists, tags, highlights, plus Aozora/Kakuyomu ruby, emphasis dots and tate-chu-yoko. | | **PDF** | Tagged, searchable, with bookmarks, metadata and `i, ii, iii, 1, 2 …` page labels. Fonts are embedded and subset by Chromium, so the file is printable elsewhere. | | **EPUB 3** | Reflowable, with the theme's CSS, a cover and landmarks. | | **Pre-export checks** | Images that will print below 300 dpi, fonts this machine does not have, a cover whose aspect ratio does not match the page. | ## Samples and CSS customizations Print magazine packages: [vertical Japanese “余白通信”](sample/css/vertical-magazine/README.md) / [horizontal Japanese “FIELD NOTES”](sample/css/horizontal-magazine/README.md). The vertical edition uses right binding and three text bands (an illustration and two text bands on article-opening pages); the horizontal edition uses left binding, two columns and full-width headings. Both use A4, 3 mm bleed and crop marks. Each ZIP contains standalone CSS, two original articles, four SVG illustrations, a four-page sample PDF, source credits and a license. These are vault CSS samples tested with Vivlio 0.17.3, not built-in themes. Setup guides are in Japanese. - **Restyle your own manuscript** → [CSS customizations](sample/README.md#cssカスタマイズ): chapter title pages and vertical multicolumn layouts with illustrations and callout boxes. - **Try a complete book** → [Complete samples](sample/README.md#完成サンプル): manuscripts, YAML settings, required assets and example outputs for fiction, essays, haiku/tanka, manuals and papers. See the [sample catalog (Japanese)](sample/README.md) for versions and downloads, and the [manual (Japanese)](manual/02-first-book.md#サンプル一式で試す) for setup. Samples using built-in themes need no additional CSS. Follow each sample's README for vault placement and folder names. The [illustrated vertical layout sample](sample/css/vertical-feature/README.md) includes Markdown, YAML, standalone CSS, original SVG illustrations and a spread preview. It demonstrates four vertical text bands on A4, a panorama occupying the first band, images within individual bands, callout boxes, and running heads and folios on the outer edges of facing pages. ## Installing **From Obsidian.** Settings → Community plugins → Browse, search for *Vivlio*, install and enable it. **By hand.** Take `main.js`, `manifest.json` and `styles.css` from a [release](https://github.com/nonkuri/obsidian-vivlio/releases) and drop them into `VaultFolder/.obsidian/plugins/vivlio/`, then reload Obsidian and enable the plugin under Community plugins. Desktop Obsidian 1.8.7 or later. The plugin prints through the Chromium that Obsidian is already running, which is why there is no mobile build. ## Opening the preview **Sync cursor: on/off** in the preview toolbar displays the current state; clicking it toggles both directions for that pane. It starts on when a preview opens. Moving the editor cursor follows the start of its paragraph in the preview; clicking preview text opens the source note at that paragraph's first line. An already open note uses its existing tab; other notes open in a new tab without splitting the editor. Headings and list items also work. Links keep their normal behavior, and selecting text does not move the editor. Synchronization waits until the displayed preview matches the edited source. With automatic refresh disabled, use **Rebuild** after editing. A paragraph spanning several pages follows its first page; generated content without a source paragraph has no cursor target. Three ways in, whichever is nearest to hand: - **The ribbon.** The book icon in the left ribbon typesets the note you are looking at. - **The command palette.** `Vivlio: Open preview` does the same. - **The file explorer's context menu.** Right-click a Markdown note for **Vivlio: preview**. Right-click a *folder* for **Vivlio: preview as a book** — every `.md` in it, in chapter order — and **Vivlio: export as a book** beside it. The pane opens on the right, with a toolbar across the top: **Rebuild**, a theme picker, and **PDF** and **EPUB** buttons that open the export dialog for whatever the pane is showing. It re-typesets as you edit the note; turn that off with **Refresh the preview automatically** in the settings, and rebuild by hand with the toolbar button or `Vivlio: Reload typeset result`. Preview display preferences are in **Settings → Vivlio → Preview**: single page, facing pages or automatic spread, fit to screen (on by default), and fixed zoom (10–1000%, default 100%). Settings apply when opening or rebuilding the preview. **Remember changes made in the viewer** is on by default: page display mode and zoom/fit changes become vault-wide defaults and survive rebuilding and restarting Obsidian. Turn it off to restore the plugin settings on each rebuild. These preferences are not exported to `vivlio.yaml` and do not affect PDF/EPUB output; paper, margins and other typesetting settings remain in the existing book configuration. ## Commands | Command | What it does | |---|---| | `Vivlio: Open preview` | Typeset the active note in a side pane | | `Vivlio: Export to PDF` / `to EPUB` | Export dialog, checks, then the file | | `Vivlio: Export this folder as a book` | Every `.md` in the folder, in order | | `Vivlio: Build a book from this note's links` | The note's `[[links]]` become the spine | | `Vivlio: Create book configuration` | Wizard that writes `vivlio.yaml` — every key, the untouched ones as comments | | `Vivlio: Add configuration to this note` | Adds, edits and removes flat `vivlio-*` frontmatter, with what each key means | | `Vivlio: Write configuration reference` | Every key, with defaults and comments | The file explorer's context menu offers preview and export as well — see [Opening the preview](#opening-the-preview). Open any `.yaml` file (for example, `print.yaml` or `ebook.yaml`) and run **Export to PDF** or **Export to EPUB** to export its whole folder as one book using the selected configuration. The same actions are available by right-clicking a YAML file in the File Explorer. Starting from a Markdown note or folder still uses the conventional `vivlio.yaml` beside the manuscript. When a multi-selection contains exactly one `.yaml`, that file is used as the configuration. With two or more YAML files—even two editions beside the same manuscript—Vivlio asks you to select one configuration at a time rather than guessing which one to use. Running **Create book configuration** while any YAML file is open also loads that file into the wizard and writes the result back to the same file. When started from Markdown, the wizard creates or updates `vivlio.yaml` as before. ## Configuring a book Three layers; a lower one overrides the one above it. 1. **Settings tab** — vault-wide defaults. 2. **`vivlio.yaml`** next to the book — the real place for a book's settings. Nesting and comments allowed. 3. **A note's frontmatter** — flat `vivlio-*` keys are recommended for Obsidian's property editor. Hand-written nested `vivlio:` settings are also accepted. For a single-note book, that note supplies layer 3. For a folder or selected YAML, the table-of-contents note supplies it; for a book built from links, the selected note does. These settings apply to the whole book. Ordinary chapter notes cannot override the theme or writing mode individually; use note classes and CSS for chapter styling. `vivlio-order`, `vivlio-toc` and `vivlio-paper-role` are note metadata. ### Editing `.yaml` and `.css` inside Obsidian Obsidian's built-in editor is centred on Markdown notes and does not provide a general editor for arbitrary `.yaml` and `.css` files. With **Show .yaml / .css / .epub in the file explorer** enabled, Vivlio makes its configuration and theme files visible and opens them in a minimal plain-text editor. For syntax highlighting, line numbers, folding, and search and replace without leaving Obsidian, [Code Space](https://community.obsidian.md/plugins/code-space) is a useful community plugin; it is also what the author of this README uses. Install it from **Settings → Community plugins → Browse** by searching for “Code Space”. It manages `.css`, `.yaml`, and `.yml` by default. If those files still open in Vivlio's minimal editor after installing Code Space, turn off Vivlio's setting above, restart Obsidian, and check that `css`, `yaml`, and `yml` are present under Code Space's **Managed extensions**. Only one plugin can own a file extension at a time. Code Space's external-folder mounting feature is not needed for this workflow. ```yaml # vivlio.yaml title: 吾輩は猫である author: 夏目漱石 theme: novel # novel, novel-2col, essay, haiku, tanka, english-novel, manual or paper, or a CSS path in the vault writingMode: vertical-rl size: 文庫 charsPerLine: 39 linesPerPage: 15 footnote: gcpm # bottom of the page cover: 装丁/表紙.png # Optional closing image: # backCover: 装丁/裏表紙.png # backCoverFit: contain sections: titlePage: auto toc: auto preface: まえがき.md colophon: auto pageNumbering: continuous # excludes covers and their unnumbered padding pages startPage: 1 # first folio; zero and negative values count but stay hidden cropMarks: false # many Japanese printers ask for no marks bleed: 3mm # …and 3mm of bleed; the sheet grows to carry it output: 原稿/出力/猫.pdf ``` `bleed` works with or without `cropMarks`. Without them the sheet is printed at the trim size plus twice the bleed, which is the shape a Japanese printer means by 「トンボなし・塗り足し3mm」; the text block keeps its place relative to the trim. Use `backCover` to append a back cover, with `backCoverFit: cover` (fill and crop, the default) or `contain` (fit the whole image). PDF and preview add a blank inside and any padding needed to place it on the final even physical page, independently of folio numbering. These closing pages have no folios, running heads or contents entries. The PDF export switch **Include front and back covers** controls both together. EPUB appends only the image, without blank pages, and keeps the front cover as its shelf thumbnail. The front/back cover images and a `coverPage` background reach the outer bleed edge with or without crop marks. Use `![[images/illustration.png|bleed]]` for a full-page bleeding illustration in the body. For a tinted page, put the class on the page element, for example `
`. Ordinary body images remain fitted inside the text block. ```yaml --- title: 吾輩は猫である vivlio-theme: manual vivlio-size: 文庫 --- ``` A note's own `title` is read as well, so a single note exported on its own needs no `vivlio-title` to name the book. Write `vivlio-title` when the two should differ — it wins — which is the form `Vivlio: Add configuration to this note` inserts, since every key it offers takes the `vivlio-` prefix. `Vivlio: Create book configuration` asks about every one of those keys and writes them all. A key you left at **Use the default** is written as a comment, so the file lists what this book could say while the book still follows the vault as its defaults change — delete the `#` to take one over. For an English trade paperback, start with the English preset in the wizard, or use these settings: ```yaml lang: en theme: english-novel writingMode: horizontal-tb size: 6x9 sections: titlePage: auto copyrightPage: auto toc: auto colophon: off ``` English books use a prose copyright page immediately after the title page; the Japanese-style colophon remains a separate, optional section at the back. When neither setting is written, `lang: en` selects the values above. The wizard also writes a language-matched `labels:` block, where headings and the copyright-page sentences can be edited without changing the theme. ```yaml # --- Typesetting --- # Page size: 文庫 (A6, 105x148mm) | 新書 | JIS-B6 | A5 | ... # size: 文庫 # Characters per line; empty lets the theme size the text block from the page charsPerLine: 39 ``` Run `Vivlio: Write configuration reference` for a `vivlio.yaml` listing every key with its default and a comment, as values rather than comments. ## Chapter order 1. A table-of-contents note (`index.md`, a note named after the folder, or one with `vivlio-toc: true`) — its `[[links]]` in the order they appear. 2. Otherwise the natural order of file names, so `2.md` comes before `10.md`. 3. `vivlio-order: 3` pins a note to a position either way. The table-of-contents note itself stays out of the book unless `includeToc: true`. `vivlio-order` and `vivlio-toc` belong to a note rather than to the book, so `vivlio.yaml` has no use for them and the configuration reference leaves them out. `Vivlio: Add configuration to this note` offers both. ## Notation Since 0.18.3, books with `lang: ja` (the default) or a Japanese language tag such as `ja-JP` preserve ordinary line breaks as `