Skip to main content
Version: 0.2

Exporting

This chapter lists every way to take your work out of Leafen: a page, a workspace, its members, a whole server, or through the API. It is for everyone; the server-wide ways are for administrators. The format of a Leafen archive is in Leafen workspace bundles, and backups are in Backups.

Export a page​

  1. Open the page's ••• menu (top right) and choose Export.
  2. Choose the Export format:
    • PDF: a print window opens; choose Save as PDF there. Page format (A4, A3, Letter, Legal or Tabloid) and Scale percent set the paper.
    • HTML: web pages you can open in any browser.
    • Markdown & CSV: Markdown for pages, and CSV for databases.
    • Leafen archive: a lossless copy of the page and its subpages, files included, that Leafen can import again.
  3. Choose what goes in:
    • Page content: Everything, or Exclude files and images.
    • Database views: Current view or Default view, for the rows a database exports.
    • Include subpages, Create folders for subpages and Export comments.
  4. Press Export. The file downloads.

A page whose linked database or relation points to a database outside it can't be exported as a Leafen archive on its own; export the workspace's archive instead. With Markdown & CSV, each database on the page is written as a CSV file of its rows.

Export a workspace​

Workspace owners and administrators (not members or guests) open Settings → General (under Workspace) → Export → Workspace content → Export. The format is HTML, Markdown & CSV or Leafen archive, with the same choices as a page, plus Include private pages. The workspace is packaged on the server first, which takes longer for a large workspace, then downloads.

A Leafen archive of a workspace goes into another Leafen through Settings → Import → Leafen, keeping its pages, databases, files and comments.

Members → Export on the same page, or the download button beside the search on Settings → People, saves a CSV of every member and guest in the workspace.

Move a workspace or a server​

  • Move to another server on Settings → General moves the workspace, with its people and page history, to another Leafen server that people already use.
  • An administrator moves a whole server with Move to another server on Settings → Server → Restore and move.

Both are described in Self-hosting: Moving to another server.

Take it anywhere​

Your work isn't tied to Leafen:

  • The software. Leafen is open source under the AGPL-3.0: you can run it on any computer or server, and anyone can carry on fixing it from the public source.
  • One folder. Everything a server holds is in its data folder. Its database, data.db, is a SQLite file (its logs are in a second one, auxiliary.db): with Leafen stopped, sqlite3 data.db opens it, or a copy of it. Page titles are in leafen_pages, the values of database rows in leafen_database_row_values (as JSON) and the blocks of a page in leafen_blocks; a page's text is kept in its collaborative-editing document in the same file, so read the text through an export rather than from the tables.
  • Moving it. Stop Leafen, copy the whole folder to the other computer and start Leafen there with --dir naming it; or make a backup file with leafen backup and restore it into a new folder with leafen restore (Backups). A server people use moves with Move to another server, as above.
  • Exports. Markdown & CSV writes each page as Markdown and each database as a CSV of its rows; HTML writes each page as a web page, with its databases as CSV beside it. In the CSV a formula's and a rollup's result is written as its value, and a relation as the related page's name with a link to its file. The formula itself, the relation as a link both ways, and the views (their filters, sorts and layouts) are not in these files.
  • Leafen archive. It keeps everything, formulas, relations, views and files included, in the format Leafen workspace bundles describes; that description is under the Apache License 2.0, so any tool may follow it. What another tool takes in from these files is up to that tool.

Back up the whole server​

An administrator's Backup file (Settings → Server → Backups) and scheduled backups hold everything on the server, logins and files included. See Backups.

When exports are turned off​

An organization can turn page exports off for its workspaces, and a teamspace can turn them off for its pages. The export window then says Exports are turned off by your organization or this page's teamspace. Ask a workspace administrator.

Names, limits and defaults​

NameLimit or defaultNotes
Page export formatsPDF, HTML, Markdown & CSV, Leafen archivePDF only through the browser's print window.
Workspace export formatsHTML, Markdown & CSV, Leafen archive
Page contentEverythingOr without files and images.
Database viewsCurrent viewOr the default view.
Export commentsOn
Members exportCSVEvery member and guest.

For agents and the API​

An agent or script reads every page and database through the API and MCP, as Building on Leafen shows; leafen_fetch and notion-fetch read a page's content, and leafen_get_file gives a file's download address. A workspace archive's format is in Leafen workspace bundles.

Differences from Notion​

  • Notion's PDF export makes the file on its servers. Leafen opens the browser's print window, where you save it as a PDF.
  • Notion has no lossless archive that goes back in. Leafen's Leafen archive brings a page or workspace into any Leafen as it was.