Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
docs(skills): drop the last references to a standalone math package
Elian Dorana66ae9f75596
diff --git a/.claude/skills/ckeditor5-plugin-development/SKILL.md b/.claude/skills/ckeditor5-plugin-development/SKILL.mdindex 933588cf4a..7cfae24c77 100644--- a/.claude/skills/ckeditor5-plugin-development/SKILL.md+++ b/.claude/skills/ckeditor5-plugin-development/SKILL.md@@ -3,7 +3,7 @@ name: ckeditor5-plugin-developmentdescription: >-Write, extend, and review CKEditor 5 plugins in the Trilium (TriliumNextNotes) monorepo — the rich-text-note editor under packages/ckeditor5, whose- plugins live in src/plugins/, plus the @triliumnext/ckeditor5-math package.+ plugins live in src/plugins/.Use when building orreviewing a Trilium CKEditor 5 feature/plugin, or when working with theediting engine (model, view, schema, conversion/upcast-downcast), commands,@@ -22,10 +22,9 @@ plugin. Without plugins the editor is an empty API. This skill is specific to **(TriliumNext Notes)**, whose rich-text note editor is built from the CKEditor 5 library(external dep, **CKEditor 5 48 or later**) plus Trilium's own plugins. Both the editor build and theplugins live in `packages/ckeditor5` (`@triliumnext/ckeditor5`): each feature is a folder under-`src/plugins/` — admonition, collapsible, footnotes, keyboard_marker, mermaid, mention, snippets-and the rest — with its tests co-located beside it. `@triliumnext/ckeditor5-math` is the only-feature still shipped as its own workspace package, because it owns a heavy exclusive dependency-(`mathlive`). The editor is consumed by `apps/client` (the text note widget). This skill distills+`src/plugins/` — admonition, collapsible, footnotes, keyboard_marker, math, mermaid, mention,+snippets and the rest — with its tests co-located beside it. No CKEditor feature ships as its own+workspace package any more. The editor is consumed by `apps/client` (the text note widget). This skill distillshow to write new Trilium plugins and review existing ones idiomatically.## When to use this skill@@ -37,7 +36,7 @@ plugin so it reaches the editor, or reviewing plugin code for correctness and cocompliance. Trigger concepts include: model/view/schema, conversion (upcast/downcast),`Command`, `editor.model.change()`, `ButtonView`/`componentFactory`, widgets (`toWidget`),`ContextualBalloon`/`Dialog`, `editor.keystrokes`, `t()` localization, the `plugins.ts`-registry / editor classes / `toolbar.ts`, or the `@triliumnext/ckeditor5-math` package.+registry / editor classes / `toolbar.ts`.## The three pillars@@ -76,7 +75,7 @@ import { Plugin, ButtonView, Command, _setModelData } from 'ckeditor5';- **Cross-plugin** imports inside `packages/ckeditor5` are **relative**, e.g.`import Kbd from './keyboard_marker/keyboard_marker.js';`. The only workspace-package import- left is `@triliumnext/ckeditor5-math`, which the aggregate pulls in from `plugins.ts`.+ in-tree under `src/plugins/`, and the aggregate registers them from `plugins.ts`.- **Every import includes its file extension** (`.js`/`.ts`/`.json`) — enforced by`eslint-config-ckeditor5` (`require-file-extensions-in-imports`), with`allow-imports-only-from-main-package-entry-point` and `no-legacy-imports` also active.@@ -284,7 +283,7 @@ review (workflow, CKEditor-specific defect patterns, contribution process), useThis skill is specific to the **Trilium (TriliumNext Notes) monorepo's** CKEditor 5 integration.Repository paths it cites — `packages/ckeditor5`, `packages/ckeditor5/src/plugins/<name>/`,-`packages/ckeditor5-math`, `apps/client/...` — are **this repository**, and examples come from+`apps/client/...` — are **this repository**, and examples come fromTrilium's own plugins (admonition, collapsible, footnotes, keyboard_marker, math, mermaid). TheCKEditor 5 **library** is an external dependency tracked at **48 or later**; its mechanics weredistilled from the upstream docs (ckeditor.com/docs) and source (github.com/ckeditor/ckeditor5,diff --git a/.claude/skills/ckeditor5-plugin-development/references/architecture.md b/.claude/skills/ckeditor5-plugin-development/references/architecture.mdindex 215cfe64cc..6660bebe7c 100644--- a/.claude/skills/ckeditor5-plugin-development/references/architecture.md+++ b/.claude/skills/ckeditor5-plugin-development/references/architecture.md@@ -7,7 +7,7 @@ The conceptual foundation. Read this before working on editing behavior.> `editor.editing`, `Plugin`, the writer, schema, conversion) are the library's, imported as> `import { Plugin } from 'ckeditor5'` (with file extensions). Paths under> `packages/ckeditor5/src/plugins/` (admonition, collapsible, footnotes, keyboard_marker, mermaid,-> …) and `packages/ckeditor5-math` are **Trilium's own** plugins that consume these APIs; the+> …) are **Trilium's own** plugins that consume these APIs; the> editor build itself is `packages/ckeditor5`. Trilium examples are cited throughout — they exercise the same library> mechanics described below.diff --git a/.claude/skills/ckeditor5-plugin-development/references/conventions.md b/.claude/skills/ckeditor5-plugin-development/references/conventions.mdindex 3125aa5c1e..ba10240ce1 100644--- a/.claude/skills/ckeditor5-plugin-development/references/conventions.md+++ b/.claude/skills/ckeditor5-plugin-development/references/conventions.md@@ -59,7 +59,7 @@ Follow the existing files in the package you touch; don't add or strip headers w`@ckeditor/ckeditor5-icons` and `@ckeditor/ckeditor5-inspector`.- **Cross-plugin** imports inside `packages/ckeditor5` are relative(`import Kbd from './keyboard_marker/keyboard_marker.js';`), as are same-plugin imports- (`import FooEditing from './foo_editing.js';`). `@triliumnext/ckeditor5-math` is the one+ (`import FooEditing from './foo_editing.js';`). The former plugin packages were the oneremaining workspace-package import.- **All imports include file extensions** (`.ts`/`.js`/`.json`) — `import './augmentation.js';`even though the source is `.ts` (`require-file-extensions-in-imports`).@@ -98,7 +98,7 @@ declare module 'ckeditor5' {- A new plugin needs **no packaging at all** — it is a folder under`packages/ckeditor5/src/plugins/` and is registered by editing `plugins.ts`. See`references/tooling-and-packaging.md` for the registration flow.-- The one surviving plugin package, `@triliumnext/ckeditor5-math`, shows the older shape:+- The former plugin packages showed an older shape, still visible in history:scope `@triliumnext/`, `"type": "module"`, `"main": "src/index.ts"` (ships TS source — noper-package dist), a `peerDependencies` entry for `ckeditor5` matching the repo's pin, pulled in with`workspace:*`. Don't copy it for new work.diff --git a/.claude/skills/ckeditor5-plugin-development/references/conversion.md b/.claude/skills/ckeditor5-plugin-development/references/conversion.mdindex e1459b27d0..1d98d3b24e 100644--- a/.claude/skills/ckeditor5-plugin-development/references/conversion.md+++ b/.claude/skills/ckeditor5-plugin-development/references/conversion.md@@ -8,7 +8,7 @@ of truth**; HTML/data is just I/O. That is why helper names look "reversed": con> All helpers and writers here come from the **`ckeditor5` library** (**48 or later**); import as> `from 'ckeditor5'` with file extensions. Trilium's own plugins under `packages/ckeditor5-*`> register converters via `editor.conversion`; real examples cited below are-> `ckeditor5-math` and `mermaid` (external/async-rendered widgets built with+> `math` and `mermaid` (external/async-rendered widgets built with> `createUIElement` render callbacks plus a data-processor wrap) and Trilium's reference-link> conversion.@@ -195,7 +195,7 @@ processor.toView = data => toView( preprocess( data ) ); // and mirror toDataUse sparingly — prefer real converters. It's for cases the converter layer can't reach, such aspreserving newlines inside a formula or shielding a fragment from generic HTML normalization.-This is the pattern Trilium's `ckeditor5-math` / `mermaid` use: a data-processor wrap+This is the pattern Trilium's `math` / `mermaid` plugins use: a data-processor wrapguards the raw formula/diagram source while a `createUIElement` render callback (see the elementcallbacks above) renders the external/async output into the editing view.diff --git a/.claude/skills/ckeditor5-plugin-development/references/review-checklist.md b/.claude/skills/ckeditor5-plugin-development/references/review-checklist.mdindex c07651ea22..6b6d0831b6 100644--- a/.claude/skills/ckeditor5-plugin-development/references/review-checklist.md+++ b/.claude/skills/ckeditor5-plugin-development/references/review-checklist.md@@ -1,6 +1,6 @@# Reviewing a CKEditor 5 plugin (Trilium)-A structured checklist for reviewing Trilium CKEditor plugin code under `packages/ckeditor5-*`.+A structured checklist for reviewing Trilium CKEditor plugin code under `packages/ckeditor5/src/plugins/`.Pair each item with the relevant reference file when you need the "why". Flag deviations; notevery item applies to every plugin (e.g. a UI-only or editing-only plugin). The Triliumintegration items at the end are specific to this monorepo.diff --git a/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md b/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.mdindex 1d39c4ece6..0515b3ca6b 100644--- a/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md+++ b/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md@@ -14,9 +14,8 @@ Separate workspace packages are no longer the pattern (see "Where a new plugin g(admonition, collapsible, footnotes, keyboard_marker, mermaid, mention, snippets, …), each afolder with its tests co-located; `src/theme/` and `src/icons/` hold their assets; built with**Vite**.-- `packages/ckeditor5-math` — `@triliumnext/ckeditor5-math`, the one remaining plugin package. It- stayed separate because it owns a heavy exclusive dependency (`mathlive`); everything else was- folded in.+ Nothing sits outside it any more: `mathlive` and the other former plugin-package dependencies+ are declared on the aggregate itself.- `apps/client/src/widgets/type_widgets/text/` — the rich-text note widget that instantiates theeditor (`config.ts`, `CKEditorWithWatchdog.tsx`, `toolbar.ts`).@@ -36,13 +35,14 @@ carrying a `ckeditor5-package-generator` scaffold — sample pages, its own ESLiconfigs, typings — that no script or CI job ever ran. Folding them in also put them under theaggregate's 100% coverage gate, which is where several latent bugs surfaced.-`packages/ckeditor5-math` is the sole exception, kept because it owns `mathlive` outright. Note-that even that is a weak reason: `mathlive` is loaded through a dynamic `import()` in the source,-so code-splitting does not depend on the package boundary.+There are no exceptions left. Math was the final holdout — kept for a while because it owns+`mathlive` — but even that was a weak reason: `mathlive` is loaded through a dynamic `import()`,+so code-splitting never depended on the package boundary.-The package layout below is documented **only** for reading `ckeditor5-math`. Do not copy it.+The package layout below is documented **only** so old branches and history stay readable.+Do not copy it.-## Plugin package layout (`packages/ckeditor5-math` only — historical)+## Plugin package layout (historical — no package uses this any more)`package.json`:@@ -193,7 +193,7 @@ For test setup, model/view assertions, and command/UI test patterns, use the sep## Scope-Paths here (`packages/ckeditor5`, `packages/ckeditor5/src/plugins/<name>/`, `packages/ckeditor5-math`, `apps/client/...`) are **this+Paths here (`packages/ckeditor5`, `packages/ckeditor5/src/plugins/<name>/`, `apps/client/...`) are **thisTrilium repository**. The CKEditor 5 library mechanics referenced (editor bases `BalloonEditor`/`DecoupledEditor`, `EditorConfig`, the watchdog) come from the external `ckeditor5` package,**48 or later**.diff --git a/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.md b/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.mdindex c6c43e47f8..4042ef7aa5 100644--- a/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.md+++ b/.claude/skills/ckeditor5-plugin-development/references/ui-and-localization.md@@ -340,7 +340,7 @@ Each Trilium plugin keeps two files under `lang/`:**Note:** the `.po`/`contexts.json` workflow described above is effectively dormant in Trilium.The folded-in plugins' `lang/` directories were dropped during consolidation because nothing in the-build or CI consumed them — only `packages/ckeditor5-math/lang/contexts.json` survives. New+build or CI consumed them, and none survive. Newuser-facing strings reach the UI either through CKEditor's own `t()` dictionary(`packages/ckeditor5/src/translation_overrides.ts`) or, for Trilium-specific strings, through thehost's `translate` config callback described below.diff --git a/.claude/skills/ckeditor5-plugin-development/references/widgets.md b/.claude/skills/ckeditor5-plugin-development/references/widgets.mdindex 3b5ca788cf..05cdaa512e 100644--- a/.claude/skills/ckeditor5-plugin-development/references/widgets.md+++ b/.claude/skills/ckeditor5-plugin-development/references/widgets.md@@ -9,7 +9,7 @@ In the Trilium monorepo the live examples are:- **admonition** (`packages/ckeditor5/src/plugins/admonition`) and **collapsible**(`packages/ckeditor5/src/plugins/collapsible`) — block widgets with nested editable content, schemainvariants enforced by `registerPostFixer`.-- **math** (`packages/ckeditor5-math`, KaTeX) and **mermaid** (`packages/ckeditor5/src/plugins/mermaid`) —+- **math** (`packages/ckeditor5/src/plugins/math`, KaTeX) and **mermaid** (`packages/ckeditor5/src/plugins/mermaid`) —external/async-rendered widgets (see the dedicated section below).Two flavors:@@ -209,7 +209,7 @@ hosting the source/preview/split-mode buttons.## External / async-rendered widgets (math, mermaid)-Trilium's **math** (KaTeX, `packages/ckeditor5-math`) and **mermaid**+Trilium's **math** (KaTeX, `packages/ckeditor5/src/plugins/math`) and **mermaid**(`packages/ckeditor5/src/plugins/mermaid`) plugins are the real-world references for this section. Widgetsthat render the output of an external library need a few patterns beyond the static-widgetbasics. The model stores the **source** (the LaTeX string / mermaid diagram code) as an@@ -267,8 +267,8 @@ async renderInto( domEl, source ) {**Lazy-load the library once.** Cache the load promise so a heavy dependency loads on first useand initializes a single time, driven from config so Trilium can supply the loader. Math reads`mathConfig.lazyLoad` (and `mathConfig.katexRenderOptions`) from `editor.config`-(`packages/ckeditor5-math/src/mathediting.ts`, `mathui.ts`); the augmentation in-`augmentation.ts` types the config shape via `declare module 'ckeditor5'`:+(`packages/ckeditor5/src/plugins/math/math_editing.ts`, `math_ui.ts`); the glue plugin in+`math.ts` types the config shape via `declare module 'ckeditor5'`:```tsthis._libPromise ??= Promise.resolve( editor.config.get( 'math.lazyLoad' )() )diff --git a/.claude/skills/ckeditor5-reviewing/SKILL.md b/.claude/skills/ckeditor5-reviewing/SKILL.mdindex e299c189d7..ab25fc540c 100644--- a/.claude/skills/ckeditor5-reviewing/SKILL.md+++ b/.claude/skills/ckeditor5-reviewing/SKILL.md@@ -3,7 +3,7 @@ name: ckeditor5-reviewingdescription: >-Review or audit CKEditor 5 plugin code in the Trilium (TriliumNext Notes)monorepo, or a PR/diff touching packages/ckeditor5 (including its in-tree- plugins under src/plugins/) or packages/ckeditor5-math. Use when checking a Trilium CKEditor 5 plugin for correctness and idiom:+ plugins under src/plugins/). Use when checking a Trilium CKEditor 5 plugin for correctness and idiom:schema / conversion / command / UI / widget code, CKEditor-specific defects(asymmetric upcast/downcast, unconsumed upcast elements, missing inline-widgetposition mapping, command refresh/isEnabled bugs, memory leaks, t() gaps,@@ -36,7 +36,7 @@ CKEditor 5 library itself is the **external `ckeditor5` dependency, 48 or later*([github.com/ckeditor/ckeditor5](https://github.com/ckeditor/ckeditor5)) are *external references*,not the code under review. Nearly all Trilium plugins live **inside** `packages/ckeditor5`, under`src/plugins/<name>/` — admonition, collapsible, footnotes, keyboard_marker, mermaid and the-in-tree plugins alongside them. `packages/ckeditor5-math` is the only remaining separate package.+in-tree plugins alongside them. There are no separate CKEditor plugin packages left.The aggregate assembles them all and is wired into the editor UI from `apps/client`.**On versions:** these skills name **major versions only** ("48 or later"). Trilium tracks CKEditor@@ -46,7 +46,7 @@ The aggregate assembles them all and is wired into the editor UI from `apps/clie## When to useReviewing a PR or diff that touches a Trilium CKEditor 5 plugin (`packages/ckeditor5/src/plugins/`-or `packages/ckeditor5-math`), the aggregate itself, or the toolbar config in `apps/client`;+), the aggregate itself, or the toolbar config in `apps/client`;auditing an existingplugin; sanity-checking your own feature before opening a PR. For *writing* the feature, use`ckeditor5-plugin-development`; for *writing tests*, use `ckeditor5-testing`.@@ -55,7 +55,7 @@ plugin; sanity-checking your own feature before opening a PR. For *writing* the1. **Scope the diff against Trilium's structure.** What surface changed — editing(schema/conversion/command), UI (componentFactory/buttons/dropdowns/balloons), a widget, config?- Which plugin (`packages/ckeditor5/src/plugins/<name>/`, or `packages/ckeditor5-math`)? Does it+ Which plugin (`packages/ckeditor5/src/plugins/<name>/`)? Does italso touch the aggregate's wiring (`packages/ckeditor5/src/plugins.ts`, `src/index.ts`) or the toolbar(`apps/client/src/widgets/type_widgets/text/toolbar.ts`)? This tells you which checklists, defectgroups, and integration checks apply.@@ -143,7 +143,7 @@ The CKEditor-general defect patterns are distilled from the companion skills andlibrary at **48 or later**; `docs/…` / `packages/…` paths in those patterns point into the**external CKEditor 5 repository** ([github.com/ckeditor/ckeditor5](https://github.com/ckeditor/ckeditor5)),not the Trilium code under review. The Trilium-specific paths-(`packages/ckeditor5/src/plugins/<name>/`, `packages/ckeditor5-math`,+(`packages/ckeditor5/src/plugins/<name>/`,`packages/ckeditor5/src/{plugins,index}.ts`, `apps/client/src/widgets/type_widgets/text/toolbar.ts`)point into the **Trilium monorepo**. To refresh, re-check those paths against thecurrent Trilium tree and bump the CKEditor version if the `ckeditor5` pin changes.diff --git a/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md b/.claude/skills/ckeditor5-reviewing/references/defect-patterns.mdindex fecfb50689..4788918691 100644--- a/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md+++ b/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md@@ -49,7 +49,8 @@ group covers the monorepo wiring/convention defects. For the idiomatic "how it s**Clipboard-pipeline handler bound to the wrong emitter (silently dead).**- Spot: `listenTo(editor.plugins.get(Clipboard), 'inputTransformation'|'contentInsertion', …)` — the- handler is attached to the `Clipboard` *umbrella* glue plugin (a real one in `ckeditor5-math/src/automath.ts:28`).+ handler is attached to the `Clipboard` *umbrella* glue plugin (Trilium's math AutoMath plugin did+ exactly this before it was removed).- Why: those events fire on **`ClipboardPipeline`**, not `Clipboard` (which only `requires` it), so thehandler never runs — no error, no test failure (a Trilium handler sat dead ~1 year this way).- Fix: `listenTo(editor.plugins.get(ClipboardPipeline), 'inputTransformation', …)`.@@ -205,8 +206,8 @@ nothing loads it, no button shows, or lint/license/localization is off.- Why: every plugin package has been folded into `packages/ckeditor5/src/plugins/` — none of themearned its scaffolding, since none had consumers outside the aggregate or was ever published.New plugins belong in `src/plugins/<name>/`, registered in `TRILIUM_PLUGINS` or- `EXTERNAL_PLUGINS`. Only `ckeditor5-math` is still separate, and only because it owns a heavy- exclusive dependency (`mathlive`).+ `EXTERNAL_PLUGINS`. No CKEditor plugin package remains separate — math was the last, and its+ heavy exclusive dependency (`mathlive`) simply moved onto the aggregate.- Fix: move it into `packages/ckeditor5/src/plugins/`.**Toolbar component not wired up.**diff --git a/.claude/skills/ckeditor5-testing/SKILL.md b/.claude/skills/ckeditor5-testing/SKILL.mdindex 1fc8d19cfb..c5ef831bb4 100644--- a/.claude/skills/ckeditor5-testing/SKILL.md+++ b/.claude/skills/ckeditor5-testing/SKILL.md@@ -3,7 +3,7 @@ name: ckeditor5-testingdescription: >-Testing CKEditor 5 plugins in the Trilium monorepo. Use when adding orreviewing unit tests for the packages/ckeditor5 aggregate (including its- in-tree plugins under src/plugins/) or packages/ckeditor5-math, debugging a+ in-tree plugins under src/plugins/), debugging afailing test, or setting up a package's test runner. Covers the WebdriverIObrowser-mode Vitest setup, the vitest.config.ts, testing against a real ClassicEditor, themodel/view helpers imported from 'ckeditor5' (_setModelData / _getModelData /@@ -17,14 +17,13 @@ description: >-Testing CKEditor 5 plugins in the **Trilium (TriliumNext Notes) monorepo**. Nearly everything livesin one package, `packages/ckeditor5`, with **tests co-located as `*.spec.ts` next to the source** —-including every plugin under `src/plugins/`. `packages/ckeditor5-math` is the last separate package-and still keeps a legacy `tests/` directory. Both gate `src/**` at **100% coverage** on all four+including every plugin under `src/plugins/`. It gates `src/**` at **100% coverage** on all fourmetrics, so every code change must ship with a test.## Scope & sourcesThis skill covers testing CKEditor 5 plugins in the **Trilium (TriliumNext Notes) monorepo**-(`packages/ckeditor5` and `packages/ckeditor5-math`). The CKEditor 5 library is 48 or later.+(`packages/ckeditor5`). The CKEditor 5 library is 48 or later.For general (non-CKEditor) Trilium testing, see the `writing-unit-tests` skill.**On versions:** these skills name **major versions only** ("48 or later"). Trilium tracks CKEditor@@ -42,7 +41,7 @@ Trilium testing (Preact components, jQuery widgets, server routes), use `writing- **Runner:** Vitest 4 or later. **No shared factory** — each package has its own`vitest.config.ts` built with `defineConfig` directly.- **One environment: WebdriverIO browser mode** (`@vitest/browser-webdriverio`, headless Chrome),- used by both `ckeditor5` and `ckeditor5-math`. Real DOM and real layout, so+ used by `ckeditor5`. Real DOM and real layout, so`getBoundingClientRect()`, `elementFromPoint()` and pointer events behave as in a browser. Gates`src/**` coverage at 100% (lines/functions/branches/statements). This is **not Playwright**.- Trilium used to run some plugins on **happy-dom**; that is gone. If you are porting an old@@ -57,9 +56,7 @@ Trilium testing (Preact components, jQuery widgets, server routes), use `writingfrom the `ckeditor5` package.- **Test-file location:** **co-located `*.spec.ts`** next to the source, including inside pluginfolders (`src/plugins/<name>/<name>.spec.ts`), with vitest `include: ['src/**/*.spec.ts']`.- `packages/ckeditor5-math` is the exception and still uses a `tests/` dir- (`include: ['tests/**/*.[jt]s']`, no `.spec` suffix); fold new math tests in alongside those, but- anything new elsewhere is co-located. `globals: true`. Coverage provider `v8`,+ `globals: true`. Coverage provider `v8`,`include: src/**` (test files themselves excluded from coverage). The aggregate keeps`allowExternal: false` so an imported sibling package cannot bleed into its report (see`references/running-and-config.md`).@@ -72,7 +69,7 @@ Trilium testing (Preact components, jQuery widgets, server routes), use `writing## Running tests```bash-pnpm --filter @triliumnext/ckeditor5-math test # one package (from anywhere)+pnpm --filter @triliumnext/ckeditor5 test # the whole suite (from anywhere)# or, from the package dir:vitest run```@@ -84,7 +81,7 @@ vitest --inspect-brk --no-file-parallelism --browser.headless=false```Root orchestration: `pnpm test:parallel` runs the light packages in parallel; `pnpm-test:sequential` runs `ckeditor5` and `ckeditor5-math` **sequentially** (browser resource+test:sequential` runs `ckeditor5` **sequentially** (browser resourcelimits), alongside the server. `pnpm test:all` runs both. Each package exposes `"test": "vitest"` and`"test:debug": "vitest --inspect-brk --no-file-parallelism --browser.headless=false"`.diff --git a/.claude/skills/ckeditor5-testing/references/patterns.md b/.claude/skills/ckeditor5-testing/references/patterns.mdindex f9312f7e80..67cc4d910a 100644--- a/.claude/skills/ckeditor5-testing/references/patterns.md+++ b/.claude/skills/ckeditor5-testing/references/patterns.md@@ -205,7 +205,7 @@ For `CKEditorError`, match the error id substring.## Reaching 100% coverage-Both `ckeditor5` and `ckeditor5-math` gate `src/**` at 100%+`ckeditor5` gates `src/**` at 100%(lines/functions/branches/statements, provider `v8`). Every branch needs a test: both states ofeach boolean, each schema-allowed/disallowed path, collapsed vs. ranged selection, and error/guardbranches. Run the package's `test` script and read the coverage text report to find uncovereddiff --git a/.claude/skills/ckeditor5-testing/references/running-and-config.md b/.claude/skills/ckeditor5-testing/references/running-and-config.mdindex 3a1fbb3de3..b148f140eb 100644--- a/.claude/skills/ckeditor5-testing/references/running-and-config.md+++ b/.claude/skills/ckeditor5-testing/references/running-and-config.md@@ -1,8 +1,8 @@# Running tests & configuration (Trilium)-Two packages carry CKEditor 5 tests: `packages/ckeditor5` (the aggregate, which holds every-in-tree plugin under `src/plugins/`) and `packages/ckeditor5-math`. Each has its own-`vitest.config.ts` built with `defineConfig` directly — there is no shared factory. Vitest is 4 or+One package carries the CKEditor 5 tests: `packages/ckeditor5` (the aggregate, which holds every+in-tree plugin under `src/plugins/`). Its `vitest.config.ts` is built with `defineConfig` directly+— there is no shared factory. Vitest is 4 orlater.## Per-package scripts@@ -17,7 +17,7 @@ Each package's `package.json` defines:Run a single package from anywhere in the monorepo:```bash-pnpm --filter @triliumnext/ckeditor5-math test+pnpm --filter @triliumnext/ckeditor5 test```Or, from the package directory: `vitest run`. Add `-t "name"` to filter by test name, or a@@ -65,19 +65,16 @@ resolves, and coverage via `v8` over `src/**` (test files themselves excluded).**Test-file location.** `packages/ckeditor5` uses **co-located `*.spec.ts`** next to the source —`include: ['src/**/*.spec.ts']` — including inside plugin folders, e.g.`src/plugins/collapsible/collapsible_editing.spec.ts`. That is the repo-wide convention (see the-`writing-unit-tests` skill). `packages/ckeditor5-math` still uses a `tests/` directory-(`include: ['tests/**/*.[jt]s']`, no `.spec` suffix); add math tests there, and use co-located-`.spec.ts` everywhere else.+`writing-unit-tests` skill).The aggregate also sets `setupFiles: ['./test/setup.ts']`, which wires the global `afterEach` thatdestroys editors created through `test/editor-kit.ts`.## Coverage scope for the aggregate (`packages/ckeditor5`)-The aggregate **imports** `@triliumnext/ckeditor5-math`, so a plain `--coverage` run instruments-its loaded `src/` too — and the `include: ['src/**']` glob matches those sibling sources, dragging-the report well below the aggregate's real number. Math carries its own 100% gate in its own-package, so scope the aggregate's report to its own sources only —+The aggregate used to import sibling `ckeditor5-*` packages, whose loaded `src/` a plain+`--coverage` run would instrument too, dragging the report below the aggregate's real number.+Nothing sibling is left, but the report is still scoped to this package's own sources —`packages/ckeditor5/vitest.config.ts` does this with:```ts@@ -115,13 +112,13 @@ The root `package.json` splits the run because the browser-mode packages competeresources:```bash-pnpm test:parallel # everything except server, ckeditor5 and ckeditor5-math, in parallel-pnpm test:sequential # server, ckeditor5 and ckeditor5-math, sequentially+pnpm test:parallel # everything except server and ckeditor5, in parallel+pnpm test:sequential # server and ckeditor5, sequentiallypnpm test:all # test:parallel && test:sequential```-`ckeditor5` and `ckeditor5-math` **must** run sequentially — running multiple headless Chrome-instances at once exhausts resources. `server` is in the same group for a different reason (shared+`ckeditor5` **must not** run alongside another browser-mode suite — multiple headless Chrome+instances at once exhaust resources. `server` is in the same group for a different reason (sharedtest DB, per `CLAUDE.md`), not browser limits. Everything else runs in parallel.## Notesdiff --git a/.claude/skills/ckeditor5-testing/references/test-conventions.md b/.claude/skills/ckeditor5-testing/references/test-conventions.mdindex 28979ae030..650f6a4df8 100644--- a/.claude/skills/ckeditor5-testing/references/test-conventions.md+++ b/.claude/skills/ckeditor5-testing/references/test-conventions.md@@ -6,7 +6,7 @@ CKEditor 5 plugin tests.## The environment: WebdriverIO browser mode-Both `packages/ckeditor5` and `packages/ckeditor5-math` run tests in **real headless Chrome** via+`packages/ckeditor5` runs its tests in **real headless Chrome** via`@vitest/browser-webdriverio`, so layout, `getBoundingClientRect()`, `elementFromPoint()` andpointer events all behave as they do in a browser. Both gate `src/**` at 100% coverage.@@ -72,12 +72,11 @@ directly: `expect( _getModelData( model ) ).toEqual( '<paragraph>…</paragraph>from `'ckeditor5'`. In-package source imports use a file extension (`../src/foo.js`).- Spies/mocks via `vi` (`vi.spyOn` / `vi.fn` / `vi.useFakeTimers`).- Test-file location: **co-located `*.spec.ts`** in `packages/ckeditor5`, including inside plugin- folders (`include: ['src/**/*.spec.ts']`). `packages/ckeditor5-math` still keeps a `tests/` dir- (`tests/**/*.[jt]s`, no `.spec` suffix); everything else is co-located.+ folders (`include: ['src/**/*.spec.ts']`).## Running the browser-mode packages-`ckeditor5` and `ckeditor5-math` run **sequentially** at the root (`pnpm test:sequential`) because+`ckeditor5` runs **sequentially** at the root (`pnpm test:sequential`) becauseeach spins up headless Chrome and they exhaust resources in parallel. Everything else runs via`pnpm test:parallel`. For a single package, use `pnpm --filter @triliumnext/ckeditor5 test` (or`...-math`).