Going further
About this site
How these docs are built with Mortar, and how editing them in your browser works.
These docs are a Mortar site in the repository's docs/ folder. Everything you read is content: try Edit this page at the bottom of any guide.
Collections and bricks
docs: each guide, with a title, a description, a section and a position for the sidebar, and a body.pages: pages outside the guides, such as the home page.
The bricks are Markdown, Callout, Figure (an image with a caption), API entry (an export from the generated reference), and, on the home page, Hero and Cards.
The API reference
The reference is generated from the packages' TypeScript sources and comments. A script runs TypeDoc over every public entry and writes a JSON file that the site renders:
pnpm reference
Run it after changing an exported API. A test fails if an export is missing from the reference.
Editing in your browser
The published content is JSON in docs/content/<collection>/<slug>.json, bundled into the app. The server renders it, so every page arrives with its content in the HTML.
In the browser, the admin saves through createContent over the session storage store: nothing is sent anywhere. Every page reads through a content source with a version signal. Once a page has hydrated, it checks whether this tab has edits, and if so bumps the version, so every read runs again against the session storage store and your edits replace the published content.
Uploads work the same way: the admin's asset library keeps files in a session storage blob store (up to 1 MB each), so you can add a Figure with your own image. Nothing leaves the tab.
While you have edits, a bar at the top of every page says so. Reset to the published site clears the session storage keys (edits and uploads) and bumps the version again, so everything returns to what's published. The admin starts afresh too.
For language models
The site follows the llms.txt convention, so an assistant can read these docs as plain Markdown:
/llms.txt: an index of every guide and every export, with links to their Markdown pages./llms-full.txt: every guide and the whole API reference in one file.- Each page as Markdown: add
.mdto its path, as in/docs/quick-start.mdor/reference/createContent.md.
They are built on request from the same published content and generated reference that the pages render, by the site's server middleware, so they never drift from the site. Each brick has a Markdown version: callouts become quotes and API entries the export's full reference.
Running it
pnpm docs # dev server on port 3100
pnpm --filter mortar-docs build