Documentation

Docs

How to use Nabu, from the first editor to a synced, themed, extended one. Every page here is a Nabu document in read-only mode, the editor itself drawing its own manual. The exact signatures are in the API reference.

Getting started

Install Nabu, mount an editor, pick a preset.

  • Installation Install Nabu, set up Vite (or SvelteKit) for its WebAssembly core, and fix the common build errors.
  • Your first editor Mount the NabuEditor component, create an editor with a factory, read and write its content, and react to changes.
  • Tour of the blocks One short story written with every block Nabu ships, then a card for each block.
  • Presets The four built-in presets (Minimal, Text, Document, Full), what each contains, their Tab default, and how to add or remove extensions.

Guides

One topic at a time: extensions, commands, persistence, regions, theming, clipboard, accessibility.

  • Extensions What an extension is, how to use the built-in ones, and how to write your own with extension().
  • Commands and keymap Run editor actions with nabu.exec, declare commands with keyboard shortcuts, remap or disable shortcuts with the keymap option, ask for confirmations, and configure Tab.
  • Persistence and sync Save a document in IndexedDB with createPersistedEditor, follow its save status, survive a corrupted record, edit in several tabs, choose how much history to keep, and sync with your own server through nabu.doc.
  • Regions Structure a long text in divisions (parts, chapters, scenes).
  • Theming Style Nabu at three levels - theme variables (the base theme and the Atelier theme), redrawing a built-in block with your own component, and writing your own blocks.
  • Clipboard and markdown What copy and cut put on the clipboard, how a paste is read (internal, HTML, markdown, plain text, files), markdown import and export with what round-trips exactly, and how links and HTML are sanitized.
  • Accessibility What Nabu does for keyboard and assistive technology users, what you should add (the accessible name of the editor), the ARIA it exposes, colour contrast of the default and Atelier themes, motion, and the known limits.
  • Language and input methods How Nabu handles IME composition (dead keys, Japanese, Chinese, Korean), what is tested and what is not, and the options for language, spellcheck, typography and the dialogue dash.
  • Blocks reference Every extension Nabu ships, one section each.

Recipes

Short, complete answers to a concrete need.

  • Autosave to your server Save the document to your own backend with subscribeLocalUpdates and load it back with a snapshot, without IndexedDB, and apply changes that arrive from elsewhere with importRemote.
  • A read-only viewer Show a stored document to readers, either with the real editor in read-only mode (same rendering as the editor) or as plain HTML from the JSON export with the public helpers (no editor, no WebAssembly).
  • A word count for a book Count words per chapter and for the whole book with regions, keep the count live while typing, show progress toward a target stored in a field, and know what the count leaves out.