Make Table Formulas a built-in feature

The formula engine, the rendered results, and the formula help now
come from src/lib/formulas/. The editor and the renderer call this
module directly. The tableFormulas contribution type is removed.

- Add the tableFormulas general setting (default on) and a switch in
  Settings > General. When it is off, formulas show as source text.
- Do not load an installed runestone.table-formulas package. Settings
  > Plug-ins marks it as included with RuneStone and tells the user
  that it can be removed. The user's files stay in place.
- Translate the formula help and the error descriptions into French,
  Japanese, and Simplified Chinese.
- Port the plugin unit tests. Test the setting and use a test-only
  contribution for the generic plugin lifecycle tests.
- Smoke tests load only Terminal. The formula and lifecycle tests use
  the built-in feature and its setting.
- Remove scripts/buildPlugins.mjs, the build:plugins script, and the
  plugin-packages requirement of the smoke runner.
- Remove RuneStone_Table_Formulas from the menu audit scope. It had no
  menu surfaces.
- Update the README, the user guides, and the developer references.
This commit is contained in:
Knotty Wyvern
2026-10-28 01:05:43 -07:00
parent 72671e5d01
commit 5e1533c371
43 changed files with 580 additions and 198 deletions
+3 -4
View File
@@ -81,6 +81,7 @@ A new command needs an entry in `generate_handler!` in `lib.rs`, in the command
| --- | --- |
| `layout/` | The app shell (`Workbench.svelte`), the file tree, tabs, panes, Settings, and dialogs |
| `editor/` | The Writer view (`LiveWriter.svelte`), the source editor (`EditorHost.svelte`), tables, links, images, and editor menus |
| `formulas/` | Table formulas: the parser and evaluator (`engine.ts`), the rendered results, the formula help, and the `tableFormulas` setting (`index.ts`) |
| `workspace/` | Tauri wrappers, document buffers, the note index and backlinks, paths, templates, and tab transfer (`tabTransfer.ts`) |
| `settings/` | The settings store (`store.ts`), and the code that moves the old browser values to the settings file (`migration.ts`) |
| `plugins/` | The plugin runtime, the SDK types (`sdk.ts`), and Settings → Plug-ins |
@@ -123,7 +124,7 @@ On macOS, it is `~/Library/Application Support/<identifier>/`. On Linux, it is `
{
"schema": 1,
"revision": 12,
"general": { "autosaveEnabled": true, "autosaveSeconds": 5, "showInternalFolder": false },
"general": { "autosaveEnabled": true, "autosaveSeconds": 5, "showInternalFolder": false, "tableFormulas": true },
"appearance": { "theme": "default", "mode": "dark" },
"customThemes": [],
"customThemesLegacy": [],
@@ -146,7 +147,7 @@ After that, `src/lib/settings/store.ts` reads the sections from memory and tells
## Product boundaries
- Workspace documents stay ordinary local files. Users keep access to them when plugins are disabled.
- The core includes basic Markdown table editing and rendering.
- The core includes Markdown table editing, rendering, and table formulas.
- Native file access, file watching, search, Git, and terminals belong in Rust.
- Optional features ship as plugins. The [plugin development reference](plugin-development.md) defines the package format and the API.
- For sync, prefer a local Git clone. Do not use a live network share as the sync path.
@@ -179,7 +180,6 @@ For type errors while you edit, run `pnpm check:watch`.
Some tests need files from outside this repository. Without those files, the tests skip and state the reason:
- `tests/unit/plugins/plugins.spec.ts` and `tests/unit/tables/formulas.spec.ts` import the compiled Table Formulas package. To run them, run `pnpm build:plugins` first. See [Build examples](plugin-development.md#build-examples).
- `tests/unit/release/installerVersion.spec.ts` needs the NSIS compiler that the Tauri CLI downloads on Windows.
- The Rust terminal tests start the real shells on the computer.
@@ -206,7 +206,6 @@ A test states what it needs near its top. The runner skips the test, with the re
| Line | Requirement |
| --- | --- |
| `// @requires plugin:table-formulas` | `plugin-packages/table-formulas/`. Run `pnpm build:plugins`. |
| `// @requires plugin:terminal` | The compiled Terminal plugin |
| `// @requires repo:RuneStone_Git/dist` | A file or folder in a sibling plugin checkout |
| `// @requires electron` | The browser engine dependencies. Run `npm ci --prefix browser-runtime`. |
+3 -2
View File
@@ -74,9 +74,10 @@ Right-click selected text in a cell for note links, external links, workspace se
**Extract current selection…** saves the selected Markdown to a new note and replaces the selection with a link to that note.
Undo restores the original text. It does not delete the new note.
## Calculate with Table Formulas
## Calculate with table formulas
These calculations need the optional Table Formulas plugin. See [Install a plugin](../plugins.md#install-a-plugin).
RuneStone calculates formulas in Markdown tables.
To show formulas as text, turn off **Settings → General → Table formulas**. The setting does not change your files.
Start a cell with `=` to make a formula. Columns use letters A, B, … AA. Row 1 is the header, so the first data row is row 2.
-1
View File
@@ -8,7 +8,6 @@
"RuneStone_Local_Autocomplete",
"RuneStone_Git",
"RuneStone_PDF_Viewer",
"RuneStone_Table_Formulas",
"RuneStone_CSV_Viewer"
],
"limits": [
-19
View File
@@ -115,24 +115,6 @@ In user instructions, do not tell users to load JSON, select a build folder, ren
Each example is specific to one plugin. Read the package scripts of a plugin before you build it.
For the RuneStone source setup, see [Run from source](development.md#run-from-source).
### Example: Table Formulas
Source: [Table Formulas repository](https://git.knottywyvern.com/kwyvern/RuneStone_TableFormulas) and the host script `scripts/buildPlugins.mjs`.
| Item | Value |
| --- | --- |
| Prerequisites | Node.js 24, pnpm 10, and the RuneStone source setup. A Table Formulas checkout in `RuneStone_Table_Formulas` beside the RuneStone folder, with `pnpm install --frozen-lockfile` complete. |
| Working folder | The RuneStone repository root |
| Command | `pnpm build:plugins` |
| Output | `<Table Formulas>/releases/runestone.table-formulas-<version>.zip` |
The `build:plugins` script builds only Table Formulas. It runs the plugin's `scripts/build.mjs`, which compiles without a type check.
It copies the compiled files to `plugin-packages/table-formulas/` in RuneStone. Host tests read that folder.
Set `RUNESTONE_TABLE_FORMULAS_ROOT` when the Table Formulas checkout is in a different location.
The plugin also has its own command. In the Table Formulas folder, `pnpm package:plugin` runs the type check, the build, and the RuneStone packager.
It finds the packager in `../RuneStone`. Set `RUNESTONE_ROOT` when the RuneStone checkout is in a different location.
### Example: Terminal
Source: [Terminal repository](https://git.knottywyvern.com/kwyvern/RuneStone_Terminal), its `package.json`, and its `scripts/build.mjs`.
@@ -364,7 +346,6 @@ Only one enabled plugin can own each key. The host removes contributions before
| Key | Purpose | Owner |
| --- | --- | --- |
| `terminal` | Mounts terminal controls in a host element. Returns update, command, and dispose functions. | Terminal plugin |
| `tableFormulas` | Evaluates and renders formulas in Markdown tables. | Table Formulas plugin |
| `git` | Supplies line blame for the editor. | Git plugin |
| `browser` | The built-in browser. | RuneStone |
+2 -5
View File
@@ -142,17 +142,14 @@ The same ID, enable, update, and removal rules apply to local and remote package
| `src/lib/plugins/backgrounds.ts` | Background frames |
| `src/lib/completion/` | The [completion API](completion.md) |
| `scripts/packagePlugin.mjs` | The packager for plugin authors |
| `scripts/buildPlugins.mjs` | The [Table Formulas build](plugin-development.md#example-table-formulas) |
### Run the plugin checks
Run these commands from the RuneStone repository root.
For the general checks, see [Checks](development.md#checks). For the browser setup, see [Browser smoke tests](development.md#browser-smoke-tests).
Some tests load the compiled feature plugins:
- `pnpm build:plugins` makes `plugin-packages/table-formulas/`. `tests/unit/plugins/plugins.spec.ts` and the feature smoke tests need it.
- The smoke tests read Terminal from `../RuneStone_Terminal/dist/`. To make it without a release ZIP, run `node scripts/build.mjs --no-package` in the Terminal folder. Set `RUNESTONE_TERMINAL_DIST` to use another folder.
The feature smoke tests read the compiled Terminal plugin from `../RuneStone_Terminal/dist/`.
To make it without a release ZIP, run `node scripts/build.mjs --no-package` in the Terminal folder. Set `RUNESTONE_TERMINAL_DIST` to use another folder.
Unit tests:
+3 -3
View File
@@ -4,7 +4,7 @@
This guide explains how to install, enable, update, and remove optional plugins such as Terminal, Git, and PDF Viewer.
Manage all plugins in **Settings → Plug-ins**. The built-in browser is part of RuneStone and is not a plugin.
Manage all plugins in **Settings → Plug-ins**. The built-in browser and table formulas are part of RuneStone and are not plugins.
Plugins run with the full access of RuneStone, including your files. There is no permission sandbox, and the author field does not prove who published the plugin. Enable only code that you trust.
@@ -50,7 +50,7 @@ If the dialog contains an update, it shows only **Apply packages**. New plugins
4. Choose **Uninstall and delete files**.
RuneStone stops the plugin in every window, then deletes its installed folder.
It keeps your downloaded ZIP, the plugin settings, and your workspace documents. For example, Table Formulas leaves the formula text in your Markdown files.
It keeps your downloaded ZIP, the plugin settings, and your workspace documents.
If you install the plugin again, it can use the kept settings. You choose again whether to enable it.
**Cancel** changes nothing. **Disable instead** stops the plugin and keeps it installed.
@@ -76,7 +76,6 @@ RuneStone uses the token for this request only and does not save it.
| Plugin | Guide |
| --- | --- |
| Terminal | [Terminal guide](guides/terminal.md) |
| Table Formulas | [Calculate with Table Formulas](guides/document-tools.md#calculate-with-table-formulas) |
| Git | [Git usage](https://git.knottywyvern.com/kwyvern/RuneStone_Git/src/branch/main/docs/usage.md) |
| Project Management | [Project Management guide](https://git.knottywyvern.com/kwyvern/RuneStone_PM/src/branch/main/project-management.md) |
| Background Slideshow | [Background Slideshow usage](https://git.knottywyvern.com/kwyvern/RuneStone_BG_Slideshow/src/branch/main/docs/usage.md) |
@@ -96,6 +95,7 @@ RuneStone uses the token for this request only and does not save it.
| The plugin shows **Removal incomplete** | Choose **Retry cleanup** to finish the removal. If the error names changed files, check that path first. |
| A Gitea release has no usable package | Check the release tag. Ask the publisher for a release with one attached plugin ZIP. |
| An old Browser plugin shows in the list | Uninstall it. The built-in browser keeps your profiles and bookmarks. |
| An old Table Formulas plugin shows in the list | Uninstall it. RuneStone does not run it. Your formulas stay in your files. See [Calculate with table formulas](guides/document-tools.md#calculate-with-table-formulas). |
To see the installed files of a plugin, choose **Show files** beside it. **Open plugins folder** opens the folder for all plugins.
When you report a plugin problem, include the plugin name and version, the RuneStone version, and the error text.
+1 -1
View File
@@ -175,7 +175,7 @@ Settings apply to all workspaces on this computer and update all open windows.
| Category | Settings |
| --- | --- |
| General | Display language, **Show .runestone folder**, and auto-save |
| General | Display language, **Table formulas**, **Show .runestone folder**, and auto-save |
| Appearance | Color theme, transparency, background image, and custom themes. See [Appearance and custom themes](guides/themes.md). |
| Plug-ins | Install, enable, update, and remove plugins. See [Install and manage plugins](plugins.md). |
| Browser | Homepage, search engine, profiles, ad blocking, and web data |