76 lines
4.1 KiB
Markdown
76 lines
4.1 KiB
Markdown
# AFFiNE document typography
|
|
|
|
The frontend source patch in `package/affine/gitea-document-typography.patch`
|
|
adopts Gitea README typography without replacing BlockSuite's document model.
|
|
At the default 16px body size, H1-H6 use 32, 24, 20, 16, 14 and 13.6px. Headings
|
|
use 1.25 line height, 24px/16px section spacing, and H1/H2 dividers. Body text
|
|
uses 1.5 line height and 16px paragraph spacing; nested lists remain compact.
|
|
Quotes and inline code retain native AFFiNE colors and formatting.
|
|
|
|
The scale and spacing are inspired by Gitea's MIT-licensed
|
|
[README markup stylesheet](https://github.com/go-gitea/gitea/blob/v1.27.3/web_src/css/markup/content.css).
|
|
This is an independently authored, scoped BlockSuite patch, not a wholesale
|
|
copy of that stylesheet; no vendored Gitea source files are changed.
|
|
|
|
The patch is limited to page mode. Canvas notes, embedded canvas previews and
|
|
database block trees retain their existing typography. Below 640px, page text
|
|
reflows to its viewport instead of following the intrinsic width of a wide
|
|
table. Tables and databases retain their native horizontal scrollers. The
|
|
existing sidebar toggle can be used to give the document the full phone width.
|
|
|
|
## Build and verify
|
|
|
|
```sh
|
|
nix build .#affine-frontend-static --option post-build-hook ''
|
|
NIXPKGS_ALLOW_UNFREE=1 nix build --impure .#checks.x86_64-linux.affine-typography --option post-build-hook ''
|
|
```
|
|
|
|
The browser check uses the real source-built frontend with an isolated backend
|
|
and anonymous, browser-local example documents. It covers light/dark desktop
|
|
and phone layouts, heading metrics, colored text/highlights, inline code,
|
|
editing, rich blocks, native canvas sizing and nested selector boundaries.
|
|
Screenshots and computed-size results are retained in the check output.
|
|
Fixture writes are restricted to the isolated loopback test server; the harness
|
|
does not accept a remote URL override.
|
|
The backend used by that check still requires explicit unfree evaluation.
|
|
|
|
## Current hectic-lab rollout
|
|
|
|
Since 2026-10-31, hectic-lab runs the source-built backend and patched frontend
|
|
together through `hectic.services.affine` and `affine-native.service`. Its
|
|
dedicated PostgreSQL, Redis and ChatGPT connector are native services as well.
|
|
There is no production AFFiNE container or `affine-frontend.service` mount.
|
|
See [native deployment and migration](./affine-native.md) for the cutover,
|
|
verification and backup record. The frontend patch remains part of the same
|
|
pinned AFFiNE source package; a read-only browser check after migration confirmed
|
|
the real document's H2 blocks retain the 24px scale.
|
|
|
|
## Historical Docker rollout
|
|
|
|
The following describes the earlier frontend-only rollout, retained for the
|
|
staging/rollback configuration. It is not the current production topology.
|
|
|
|
`affine-frontend-static` contains regular, copied web assets, including admin
|
|
and mobile directories and upstream license notices. It does not contain
|
|
symlinks into store paths that would be unavailable inside a container.
|
|
|
|
The existing Docker backend, database, Redis instance, image digests and data
|
|
paths remain unchanged. A companion `affine-frontend.service` applies a Compose
|
|
override mounting the source-built assets read-only at `/app/static`. It uses
|
|
`up --detach --no-deps --force-recreate affine`: only the application container
|
|
is reconciled. The main `affine.service` keeps its existing start/stop behavior.
|
|
|
|
Changing the frontend reloads the companion unit. Stopping/removing that unit
|
|
recreates the application from the base Compose configuration, restoring the
|
|
stock frontend. A restart of the parent stack reapplies the frontend afterward.
|
|
Database credentials and keys remain generated runtime state; no secret values
|
|
are embedded in the Nix store or repository by this frontend change.
|
|
Frontend and backend release versions must match; the NixOS configuration
|
|
asserts this before deployment.
|
|
|
|
Take a database/state backup before applying the first rollout, and verify that
|
|
PostgreSQL, Redis and migration container IDs remain unchanged. No database
|
|
upgrade or native-backend migration is part of this change. Application startup
|
|
may perform its usual background work; this is not a claim that the process
|
|
never writes to its database.
|