Files
Elian DoranandClaude Opus 5.5 8e063854d4 test(share-theme): cover the app view host and its views
The share-theme gate requires 100% and stood at 82.6% of lines:
`app_host.tsx`, `app_view.ts`, `collection_view.tsx` and
`app_globals.ts` had no spec, and `note_view.tsx` covered only the
widget fallback.

`app_host.spec.tsx` mocks the client modules the host wires together
(froca, options, `appContext`, the link menu, the image URL resolver)
and drives a shared page, a static export page, a note missing from
froca and clicks on links into the tree. `app_view.spec.ts` imports
`app_globals.ts` for real, so the jQuery globals are checked rather than
mocked. The note view spec now mounts each view the share theme draws
its own way, and unmounts each container after a test: emptying it left
the Mermaid view's theme observer alive, which drew again in the next
test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-10 19:03:36 +03:00
..

Share theme

The default theme for shared notes and for the static HTML export. It started as the theme of trilium.rocks by Zerebos.

  • src/templates/ — the EJS templates. packages/trilium-core/src/share/content_renderer.ts renders them on the server; a note can replace page.ejs with its own through ~shareTemplate.
  • src/page/ — the parts of the page around the note (layout, header, navigation tree, search, table of contents, footer), and src/content/ — the styles and enhancements for the note's own content (math, Mermaid, link embeds, adaptive colors). A script imports its own stylesheet, which shares its name and folder: toc.ts imports ./toc.css.
  • src/index.ts — the entry point. It sets every script up and imports the stylesheets that have no script; the order of its imports is the cascade order.

The client's Vite build bundles them, with shareTheme() from apps/client/vite-plugins.mts, into scripts.js, scripts.css and tree.js beside its own chunks, so the theme and the app load one copy of the code they share, and lists the files in share_theme.json for the static export. The development servers answer the three files from source.