rapier-math 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/api.md CHANGED
@@ -7,9 +7,11 @@ keep the host's Markdown parser in charge.
7
7
  ## Start with a formula
8
8
 
9
9
  ```sh
10
- npm install rapier-math
10
+ npx rapier-math add
11
11
  ```
12
12
 
13
+ Installs into npm, plain HTML, React, Vue, Svelte, Astro or Next projects, or run `npm install rapier-math`.
14
+
13
15
  ```js
14
16
  import {render} from 'rapier-math';
15
17
  const source = String.raw`\frac{-b\pm\sqrt{b^2-4ac}}{2a}`;
@@ -19,15 +21,15 @@ else console.log(result.svg);
19
21
  ```
20
22
 
21
23
  Keep `source` for editing and copying. A formula API accepts TeX without Markdown delimiters.
22
- `String.raw` helps with JavaScript literals; JSON and transport decoding are separate layers. Never unescape
23
- the TeX a second time. Native ESM works in Node 22+, current browsers and module workers; no CommonJS wrapper
24
+ `String.raw` helps with JavaScript literals. JSON and transport decoding are separate layers. Never unescape
25
+ the TeX a second time. Native ESM works in Node 22+, current browsers and module workers. No CommonJS wrapper
24
26
  is provided. Server output needs no client renderer unless fitting or further rendering is wanted.
25
27
 
26
28
  ## One file or native modules
27
29
 
28
30
  For a one-file browser or inline-script integration, use `dist/rapier-math.js` and
29
31
  `globalThis.RapierMath.renderToString(source)`. This classic file contains the complete
30
- formula renderer and font; it needs no sibling modules or runtime download.
32
+ formula renderer and font. It needs no sibling modules or runtime download.
31
33
 
32
34
  The native `dist/index.mjs` entry is a small facade importing the relative `src/math/`
33
35
  module graph. It is not a standalone file to copy or inline. Install the whole package,
@@ -53,10 +55,10 @@ MathML once and return their standalone SVG separately. Check `semantics.status`
53
55
  The [semantic contract](semantics.md) describes mappings, exact-source annotations, link
54
56
  tradeoffs, sanitizer/CSP order and the separate manual screen-reader acceptance steps.
55
57
 
56
- Both Markdown adapters accept `accessible: true`; their normal grammar is unchanged. Cache
58
+ Both Markdown adapters accept `accessible: true`. Their normal grammar is unchanged. Cache
57
59
  entries retain only immutable scalar/string output, never a shared semantic tree or HAST.
58
60
  Native entries execute the carried source modules directly, sharing one parser and alphabet
59
- mapping. SVG-only imports do not reach MathML; MathML-only imports do not reach fonts, layout or
61
+ mapping. SVG-only imports do not reach MathML. MathML-only imports do not reach fonts, layout or
60
62
  browser observers. The classic offline script includes all formula outputs.
61
63
 
62
64
  ## Markdown
@@ -79,16 +81,16 @@ Default delimiters are `\(...\)` (inline), `\[...\]` and `$$...$$` (display). Si
79
81
 
80
82
  | Boundary rule | Contract |
81
83
  | --- | --- |
82
- | Escapes | An odd run of preceding backslashes escapes a delimiter; an even run does not. The body is never unescaped. |
84
+ | Escapes | An odd run of preceding backslashes escapes a delimiter. An even run does not. The body is never unescaped. |
83
85
  | Dollar runs | Only complete runs of one or two dollars are delimiters. Three or more are literal. `\$$` is an escaped pair. |
84
- | Single dollars | Nonempty body, no leading/trailing whitespace or CR/LF; a closer followed by an ASCII digit is rejected. |
86
+ | Single dollars | Nonempty body, no leading/trailing whitespace or CR/LF. A closer followed by an ASCII digit is rejected. |
85
87
  | Other pairs | Whitespace and newlines are allowed. The first unescaped matching closer wins. No delimiter nesting. |
86
88
  | Blocks | A display opener at the host's block start and a closer followed only by line whitespace makes a block. Otherwise it is inline content. |
87
89
  | Incomplete input | No math node is emitted until a matching closer exists. Surrounding text stays under host control. |
88
90
  | Protected source | Code spans, fences, indented code, link destinations, autolinks and HTML tags remain host syntax. Math in link labels is disabled. Math in image descriptions is retained as literal source in alt text. |
89
91
 
90
92
  Use `html: false` for untrusted Markdown. If your application enables raw HTML, retain its sanitizer and
91
- HTML policy. Inline HTML element contents follow the host grammar; the math adapter is not an HTML parser.
93
+ HTML policy. Inline HTML element contents follow the host grammar. The math adapter is not an HTML parser.
92
94
  The `rapier-math/delimiters` export offers `createMathMatcher(source, options)(start, limit?)` for authors of
93
95
  other host adapters. It indexes boundaries in a raw text region, returns exact UTF-16 offsets, and knows
94
96
  nothing about Markdown structure. Do not scan rendered HTML with it.
@@ -111,7 +113,7 @@ It does not turn authored raw HTML into trusted markup or loosen the global SVG
111
113
  The optional `hast-util-from-html` peer is used only by this entrypoint.
112
114
 
113
115
  Choose `remarkMath({singleDollarTextMath: false})` to avoid single-dollar ambiguity. Remark owns delimiter,
114
- whitespace and code rules in this pipeline; its grammar is different from the markdown-it adapter and does
116
+ whitespace and code rules in this pipeline. Its grammar is different from the markdown-it adapter and does
115
117
  not enable backslash delimiters. Unsupported formulas remain copyable code and produce VFile messages
116
118
  with `ruleId`, `mathOffset` and `mathSource`.
117
119
 
@@ -119,7 +121,7 @@ Both rendering adapters accept `accessible` (default false), `renderOptions`, `m
119
121
  16 Mi UTF-16 code units of successful formula insertion markup per document render, excluding the host's
120
122
  display wrapper). Each occurrence spends both count and output admission, including cache hits. Rendering
121
123
  an already parsed markdown-it tree again starts a fresh budget. Ordinary inline descendants share their
122
- active parent's budget; independent reentrant renders receive their own. Reusing an `env` object does
124
+ active parent's budget. Independent reentrant renders receive their own. Reusing an `env` object does
123
125
  not extend a budget. Exhaustion leaves source literal with diagnostics. The host owns its source, tree,
124
126
  prose and final HTML budgets. These are synchronous adapters.
125
127
 
@@ -146,26 +148,26 @@ try {
146
148
  ```
147
149
 
148
150
  Use one stream handle per message and associate the supplied session deliberately. `write` accepts
149
- decoded strings and returns a whole preview or `null`; `finish` always runs the batch renderer on the
151
+ decoded strings and returns a whole preview or `null`. `finish` always runs the batch renderer on the
150
152
  complete exact source. The host replaces its previous preview and retains `source` for editing/copying.
151
- Show incoming chunks with text rendering for immediate progress; never concatenate them into HTML.
153
+ Show incoming chunks with text rendering for immediate progress. Never concatenate them into HTML.
152
154
  The stream owns no DOM, timers, transport callbacks or global conversation cache. Importing the stream
153
155
  entry alone does not load the formula renderer. See the complete [stream example](../examples/stream.mjs).
154
156
 
155
157
  `stream = stream.reset()` closes the old handle, releases its source and artifacts, and returns a fresh
156
158
  replacement with an advanced revision. Each producer must capture its own handle. Old producers' `write`
157
- and `finish` then refuse even if cancellation races; do not let an old producer read a mutable variable
158
- holding the replacement. Cancel transport as well. `abort` closes a handle and releases its pending work;
159
- it is idempotent. A completed handle cannot accept more chunks. Stream handles cannot reenter themselves.
159
+ and `finish` then refuse even if cancellation races. Do not let an old producer read a mutable variable
160
+ holding the replacement. Cancel transport as well. `abort` closes a handle and releases its pending work.
161
+ It is idempotent. A completed handle cannot accept more chunks. Stream handles cannot reenter themselves.
160
162
 
161
163
  A renderer throw or a non-string result disposes the current reuse session immediately while preserving
162
164
  all accepted chunks. Retry `finish()` explicitly to render them with a fresh session, or reset/abort. A
163
- source-budget rejection never accepts or silently truncates the rejected chunk; the caller still owns it.
165
+ source-budget rejection never accepts or silently truncates the rejected chunk. The caller still owns it.
164
166
  A rejected chunk does not discard earlier admitted source or its valid artifacts.
165
167
 
166
168
  Markdown references, setext headings and fences can change earlier interpretation, so previews are
167
169
  replaceable. An open formula remains literal under its host's grammar. Defaults: at most 1,000,000 retained
168
- source code units; first preview at 256 units, then only after source length has at least doubled. Including
170
+ source code units. First preview at 256 units, then only after source length has at least doubled. Including
169
171
  one `finish`, the source passed to the host is less than three times the final nonempty length, even when
170
172
  previews fail. Explicit finish retries add host calls. `previewEvery` sets the first threshold, not a fixed
171
173
  per-chunk interval. Parsing, prose rendering and HTML/HAST production still run for every whole preview.
@@ -192,19 +194,19 @@ the session into long-lived processor options or reuse it across messages. Omitt
192
194
  keeps ordinary adapter rendering free of persistent formula retention. A session is not a document budget,
193
195
  parser, source archive or permission to change any document.
194
196
 
195
- `session.clear()` releases artifacts while leaving that message owner open; counters remain cumulative.
197
+ `session.clear()` releases artifacts while leaving that message owner open. Counters remain cumulative.
196
198
  `session.dispose()` permanently closes it and is idempotent. Use a new session for a replacement message.
197
199
  A disposed or unrecognized session refuses. Adapter throws clear artifacts and restore the enclosing
198
- render frame; the stream additionally disposes its failed lifetime. Interleaved messages keep separate
200
+ render frame. The stream additionally disposes its failed lifetime. Interleaved messages keep separate
199
201
  sessions. Each successful occurrence receives a fresh result object and, for rehype, fresh HAST nodes.
200
202
 
201
203
  ### Configuration, retention and costs
202
204
 
203
205
  With an explicit reuse session, a document captures supported plain-data `renderOptions` and a copy of
204
206
  `screen` when its root render starts. Without a session, options retain ordinary per-occurrence reads. Its exact source, output mode, display mode, width and every screen field form the reuse key. Later root
205
- renders see option changes; an active outer render keeps its captured options during nested renders.
207
+ renders see option changes. An active outer render keeps its captured options during nested renders.
206
208
  Data-shaped proxies use their actual acquired values for both the key and renderer, including invalid
207
- values or failed acquisition; a failure is not silently retried to obtain a different option. Snapshot
209
+ values or failed acquisition. A failure is not silently retried to obtain a different option. Snapshot
208
210
  inspection may invoke prototype or descriptor traps before property reads, so side-effectful Proxy traps
209
211
  need not observe ordinary spread order. Use stable data options for predictable message reuse. Structurally unsupported accessors retain
210
212
  the ordinary per-occurrence path. Keys use a fixed tuple of numbers/booleans followed by exact source, with no arbitrary-object JSON
@@ -212,7 +214,7 @@ serialization. Accessors, exotic prototypes, coercible nonnumeric widths, unknow
212
214
  option shapes take the ordinary uncached renderer path. Their accessors are not read just to form a key.
213
215
  New output/semantic/representation options must join this configuration contract before reuse is enabled.
214
216
 
215
- Default limits are 128 entries, `maxRetainedBytes: 2097152` and `maxEntryBytes: 262144`; the entry limit is
217
+ Default limits are 128 entries, `maxRetainedBytes: 2097152` and `maxEntryBytes: 262144`. The entry limit is
216
218
  capped by the total. All limits are finite nonnegative integers. Pass them to `createMathSession(limits)`
217
219
  or `createMarkdownStream(renderMarkdown, {reuse: limits})`. `reuse: false` disables stream retention while
218
220
  keeping the same host and admission path. Least recently used successes are evicted. An entry too large
@@ -225,39 +227,39 @@ and field name, eight bytes per scalar field, and a 128-byte entry allowance. Th
225
227
  payloads. `stats` reports entries, key/artifact/total bytes, peak accounted bytes, hits, evaluations,
226
228
  bypasses, evictions and disposal. These are logical payload/work counters, not physical heap or device
227
229
  memory limits. JavaScript engines may use sliced strings, ropes and different object overheads. Stream
228
- source retention is separate and grows with admitted message length; caller-held snapshots remain the
230
+ source retention is separate and grows with admitted message length. Caller-held snapshots remain the
229
231
  caller's responsibility. Sessions never retain calculated HAST trees or renderer callbacks.
230
232
 
231
233
  The current expanded SVG is safe to reuse because it contains no occurrence identity. Serialized results
232
234
  with IDs, local references or accessibility ID references bypass retention, including if a renderer's
233
235
  default changes. Compact SVG/semantic composition must cache an occurrence-neutral prepared artifact and
234
- materialize the caller's namespace for every insertion; already namespaced output must never enter this
236
+ materialize the caller's namespace for every insertion. Already namespaced output must never enter this
235
237
  cache. Output admission runs after the complete insertion payload is materialized. Unknown nested result
236
238
  payloads also bypass until they have an explicit ownership and accounting contract.
237
239
 
238
240
  Retained state is bounded by configured logical budgets plus the admitted source, not constant memory.
239
- Repeated formulas can avoid parse/layout/serialization; mostly unique, oversized and failing formulas
241
+ Repeated formulas can avoid parse/layout/serialization. Mostly unique, oversized and failing formulas
240
242
  pay cache bookkeeping without that benefit. Whole-host parsing may dominate prose-heavy documents.
241
243
  Transport chunks may split delimiters, CRLF, escapes or surrogate pairs. Final source remains the exact
242
- concatenation without normalization; an interim preview may contain an incomplete code unit.
244
+ concatenation without normalization. An interim preview may contain an incomplete code unit.
243
245
 
244
246
  ## Formula API and browser lifetime
245
247
 
246
248
  | Export | Result |
247
249
  | --- | --- |
248
- | `render(tex, options?)` | `{svg, width, height, depth, lines, fitted, errors}`; dimensions in mathematical ems. |
250
+ | `render(tex, options?)` | `{svg, width, height, depth, lines, fitted, errors}`. Dimensions in mathematical ems. |
249
251
  | `renderToString(tex, options?)` | SVG, including diagnostic SVG for admitted malformed or unsupported syntax. |
250
- | `parse(tex)` | Inspectable AST; throws structured errors. Internal node vocabulary can grow. |
252
+ | `parse(tex)` | Inspectable AST. Throws structured errors. Internal node vocabulary can grow. |
251
253
  | `fit(container)` | One synchronous DOM fitting pass, returning selected formula count. |
252
- | `observe(container)` | Observe current formulas; returns idempotent cleanup. |
254
+ | `observe(container)` | Observe current formulas. Returns an idempotent cleanup. |
253
255
  | `version` | The package version. Default export provides the same API. |
254
256
 
255
257
  `displayMode`, `maxWidth` in mathematical ems, and optional `screen: {fontSize, pixelRatio, dark}` configure
256
258
  rendering. `preview: true` renders a formula that is still being typed: a missing argument shows a box, groups,
257
259
  fences and environments left open close, and a half-typed command before `caret` (default: the end) waits.
258
260
  Any other fault is still an error. `spans: true` marks each symbol with `data-math-at`, its offset in the source, so a tap
259
- on a symbol can place the cursor there. Screen numbers must be positive finite values; `dark` must be boolean. Omit screen options for
260
- SSR and the initial hydration render. Long rows break at available relations/operators; indivisible
261
+ on a symbol can place the cursor there. Screen numbers must be positive finite values. `dark` must be boolean. Omit screen options for
262
+ SSR and the initial hydration render. Long rows break at available relations/operators. Indivisible
261
263
  oversized groups scale to fit. Fit after hydration, stop observation before replacement, then observe the
262
264
  new formulas. Stop on unmount. [Browser](../examples/browser.html), [worker](../examples/worker.mjs) and
263
265
  [React/SSR](../examples/react.tsx) examples demonstrate these boundaries. React is not a package dependency.
@@ -274,12 +276,12 @@ diagnostic message as a source archive.
274
276
  Valid XML source is kept exactly in SVG `aria-label` and `title`, including BOM, tabs and CRLF (escaped as
275
277
  character references). Invalid XML characters have visible Unicode escapes and a `data-tex-utf16` carrier:
276
278
  each four hex digits represents one original UTF-16 code unit. This includes isolated surrogates. The
277
- Markdown host may normalize its syntax-node content; retain the original Markdown separately. Streams
279
+ Markdown host may normalize its syntax-node content. Retain the original Markdown separately. Streams
278
280
  return the exact concatenated source, including malformed UTF-16, without normalization.
279
281
 
280
282
  Source longer than 1,000,000 code units returns a bounded `resource-limit` diagnostic before source
281
283
  scanning, escaping or parsing. Its error has `sourceOmitted: true` and its SVG has
282
- `data-math-source-omitted="true"`; neither embeds or truncates the refused source. `renderToString` returns
284
+ `data-math-source-omitted="true"`. Neither embeds or truncates the refused source. `renderToString` returns
283
285
  the same diagnostic SVG. Keep the original input for editing or copying. Admitted source alternatives
284
286
  remain exact. Other limits include 100,000 tokens, 50,000 parser nodes, depth 192, 4096 macro expansions, 100,000 layout
285
287
  visits, 4 Mi outline characters and 8 Mi composed SVG characters. Complete returned SVG, including source
@@ -289,7 +291,7 @@ heap or device-memory claims. A later good render has a fresh budget.
289
291
  SVG-only output labels contain raw TeX, not MathML or mathematical speech. Ordinary SVG equations are images in
290
292
  the accessibility tree. Equations with authored HTTP(S) links use a group so the links remain exposed,
291
293
  keyboard-focusable and labeled with their destinations. Use `rapier-math/mathml` for structured MathML or
292
- `rapier-math/accessible` with `rapier-math/accessible.css` for MathML-backed presentation; see
294
+ `rapier-math/accessible` with `rapier-math/accessible.css` for MathML-backed presentation. See
293
295
  [MathML and accessibility](semantics.md). Keep editable source or a copy-source control in the host.
294
296
  Mathematical speech, navigation and screen-reader parity still need host testing. Improving SVG-only
295
297
  accessibility remains future work.
@@ -304,20 +306,20 @@ escaped text rendering. Formula safety does not sanitize surrounding Markdown.
304
306
  The native ESM path needs no `eval` or `unsafe-eval`. Generated SVG does contain style attributes:
305
307
  `script-src 'self'; style-src-attr 'unsafe-inline'; style-src-elem 'none'` permits same-origin external
306
308
  modules and those attributes in browsers implementing CSP3. It does **not** work under a policy forbidding
307
- all inline styles. `examples/browser.html` carries that policy; older browsers need their own reviewed
308
- style policy. No network access is needed after local module loading; use `connect-src 'none'` if suitable.
309
+ all inline styles. `examples/browser.html` carries that policy. Older browsers need their own reviewed
310
+ style policy. No network access is needed after local module loading. Use `connect-src 'none'` if suitable.
309
311
 
310
312
  With `require-trusted-types-for 'script'`, string HTML sinks and the DOMParser used by `fit`/`observe`
311
313
  require TrustedHTML. The core does not create a policy, return TrustedHTML or claim fitting support under
312
314
  that policy. Prefer server-rendered output or the structured rehype path in such applications. If the host
313
- uses a policy for initial insertion, narrowly scope it to freshly generated renderer output; never use a
315
+ uses a policy for initial insertion, narrowly scope it to freshly generated renderer output. Never use a
314
316
  blanket identity policy for arbitrary strings. The browser/React examples assume string sinks are permitted.
315
317
 
316
318
  ## Syntax and limits
317
319
 
318
320
  Supported: fractions, roots, scripts, limits, matrices/arrays/alignment, delimiters, accents, operators,
319
321
  Greek and mathematical alphabets, text/color/size/spacing, local macros, and selected chemistry/physics.
320
- Existing supported package names select built-in syntax; there is no external package/file loader.
322
+ Existing supported package names select built-in syntax. There is no external package/file loader.
321
323
  This is not a complete TeX document engine. No automatic numbering or cross-formula reference guarantee.
322
324
  Unsupported commands give diagnostics. Lowercase script/bold-script requests use ordinary-letter fallbacks
323
325
  where Latin Modern lacks those alphabets. All embedded licensed outlines remain present. Letters, digits
@@ -327,7 +329,7 @@ the reader's own serif font, fitted to an estimated width, rather than refused.
327
329
  ## Package and proof
328
330
 
329
331
  Declarations accompany every public entry. Formula imports do not pull in Markdown, unified or React.
330
- For TypeScript, markdown-it 15 provides its own types; markdown-it 14 projects also install
332
+ For TypeScript, markdown-it 15 provides its own types. Markdown-it 14 projects also install
331
333
  `@types/markdown-it@14`. Use the declarations for your host version.
332
334
  For a classic script, use `dist/rapier-math.js` and `globalThis.RapierMath`.
333
335
  The payload includes the font: it is not a few-kilobyte renderer. Payload counts below describe this
@@ -338,8 +340,8 @@ classic payload and ESM modules and updates their source receipt and component p
338
340
  the adapters, declarations and examples. Follow
339
341
  `docs/font-source.md` to regenerate font data. License and font provenance are carried with every build.
340
342
 
341
- Verified-claim scope: synchronous self-contained formula rendering; opt-in Markdown integrations; bounded
342
- replaceable previews with exact final source; structured diagnostics and explicit source fallback. This
343
+ Verified-claim scope: synchronous self-contained formula rendering. Opt-in Markdown integrations, bounded
344
+ replaceable previews with exact final source. Structured diagnostics and explicit source fallback. This
343
345
  does not establish all-device behavior, full TeX compatibility, semantic accessibility or universal
344
346
  size/speed superiority. Test your host's sanitizer, CSP, browser lifetime and supported formula corpus.
345
347
 
@@ -24,13 +24,13 @@ The generator's font and GUST license URLs are under
24
24
  <https://www.latex-project.org/lppl/lppl-1-3c.txt>. Each download is checked against its content hash.
25
25
  The Mono input comes from
26
26
  <https://ftp.riken.jp/CTAN/fonts/lm/fonts/opentype/public/lm/lmmono10-regular.otf> and the hook from
27
- <https://ftp.riken.jp/CTAN/fonts/lm/fonts/type1/public/lm/lmmi10.pfb>;
28
- their [complete original package](https://mirrors.ctan.org/fonts/lm.zip) is also available from CTAN.
27
+ <https://ftp.riken.jp/CTAN/fonts/lm/fonts/type1/public/lm/lmmi10.pfb>.
28
+ Their [complete original package](https://mirrors.ctan.org/fonts/lm.zip) is also available from CTAN.
29
29
 
30
30
  `FONT-LICENSE.txt` starts with the source fonts' exact copyrights, followed by the conversion notice and the complete,
31
- unmodified GUST Font License and LPPL 1.3c. The same bytes are retained in the `/*! ... */` header of `font.js`,
31
+ unmodified GUST Font License and LPPL 1.3c. The same text is kept in the `/*! ... */` header of `font.js`,
32
32
  the plug-in and its license sheet. Preserve this notice when packaging. The conversion has a different filename
33
- and identifies its changes; the original font authors do not maintain it. Rapier's separate typesetter is MIT.
33
+ and identifies its changes. The original font authors do not maintain it. Rapier's separate typesetter is MIT.
34
34
 
35
35
  The calibration font is the editor's exact Geist file, from the pinned public source at
36
36
  <https://raw.githubusercontent.com/jackskip22/rapier/326a7387a190b011543fae5f5f2c6144f6163b3d/src/shell/fonts/Geist.wght400-700.woff2>.
@@ -59,9 +59,9 @@ substitutions that the math syntax does not select are not included. Thirty-five
59
59
  **4,776**. The math font's 62 mathematical monospace letters and digits exactly match the Mono source's original
60
60
  outlines and advances. Its 32 ASCII punctuation characters, U+2423 visible space and U+00DF sharp s have no
61
61
  mathematical monospace code points, so `styledGlyphs.monospace` selects their Mono outlines and 525-unit advances.
62
- The visible-space contour also matches Computer Modern Typewriter's visible space; `\verb*` assigns that command's
62
+ The visible-space contour also matches Computer Modern Typewriter's visible space. `\verb*` assigns that command's
63
63
  TeX height and depth without changing its ink. The small `arrowhookleft` outline supplies amsmath's extensible hooked
64
- arrow; the composer assigns its five-mu advance and three-mu join. The outline-only hook record has zero advance,
64
+ arrow. The composer assigns its five-mu advance and three-mu join. The outline-only hook record has zero advance,
65
65
  italic correction and accent attachment, and retains the original path.
66
66
 
67
67
  The exact-outline claim applies to this font asset. Separately, the typesetter's `fallbacks.js` composes 29
@@ -74,11 +74,11 @@ Styled accented letters combine mathematical alphabet glyphs with accent marks.
74
74
  LuaTeX's default precomposed text-font letters for those two commands.
75
75
 
76
76
  Latin Modern Math has uppercase script and bold-script alphabets but no lowercase glyphs in either style.
77
- The typesetter retains its existing ordinary-letter fallback for those lowercase requests; it cannot supply
77
+ The typesetter retains its existing ordinary-letter fallback for those lowercase requests. It cannot supply
78
78
  the absent calligraphic forms. Its unencoded glyphs contain no alternative lowercase script alphabet.
79
79
 
80
80
  Different zlib versions can encode the same exact data differently. The package budget is measured with
81
- Node 22.23.3 by `src/tools/build-math.mjs`; the packed stream always decodes to the original coordinates and metrics.
81
+ Node 22.23.3 by `src/tools/build-math.mjs`. The packed stream always decodes to the original coordinates and metrics.
82
82
 
83
83
  ## Height and optical forms
84
84
 
@@ -88,13 +88,13 @@ Math therefore scales by **530/431**, approximately **1.2296983758700697**, rela
88
88
  The font's italic `x` retains its designed overshoot, with bounds −11–442.
89
89
 
90
90
  Geist's nominal height remains 530 across its weight axis. Its drawn `x` reaches 532 at weight 500, 535 at 650,
91
- and 536 at 700; the normalization uses the nominal height. It applies continuously at every text size.
91
+ and 536 at 700. The normalization uses the nominal height. It applies continuously at every text size.
92
92
  Latin Modern supplies 70% and 50% optical script scales. Screen layout can enlarge scripts while retaining the
93
93
  appropriate `ssty` outlines. The source's fraction and radical rule thicknesses are 40 units.
94
94
 
95
95
  ## Runtime schema
96
96
 
97
- The asset initializes `MATH_FONT`. Paths use upward-positive font coordinates; SVG rendering reverses the
97
+ The asset initializes `MATH_FONT`. Paths use upward-positive font coordinates. SVG rendering reverses the
98
98
  vertical axis. Measurements are in design units unless specified otherwise.
99
99
 
100
100
  | Field | Value |
@@ -103,9 +103,9 @@ vertical axis. Measurements are in design units unless specified otherwise.
103
103
  | `textUnits`, `textXHeight` | Geist units per em and nominal x-height. |
104
104
  | `chars` | Decimal Unicode code point to glyph index. |
105
105
  | `styledGlyphs` | A style's exceptional Unicode mappings: monospace punctuation, visible space and sharp s select original Mono outlines. |
106
- | `arrowHook` | The original small math-italic hook outline; the arrow composer supplies its advance. |
106
+ | `arrowHook` | The original small math-italic hook outline. The arrow composer supplies its advance. |
107
107
  | `glyph(id)` | Demand-decoded `[advance, xMin, yMin, xMax, yMax, italicCorrection, topAccent, path]`. Missing IDs return `undefined`. |
108
- | `constants` | The 48 consumed original OpenType `MathConstants`; percentage constants remain percentages. |
108
+ | `constants` | The 48 consumed original OpenType `MathConstants`. Percentage constants remain percentages. |
109
109
  | `vertical`, `horizontal` | Glyph index to `{variants, assembly?}`. |
110
110
  | `variants` | `[glyphIndex, advanceMeasurement]` pairs in font order. |
111
111
  | `assembly` | `{italic, parts}`. |
@@ -117,50 +117,50 @@ vertical axis. Measurements are in design units unless specified otherwise.
117
117
  | `verticalBounds` | Sparse `[bottom, top]` control bounds, in font units, for vertical glyphs whose LuaTeX box differs from their exact ink bounds. |
118
118
 
119
119
  Outline bounds round outward to whole units. The outlines themselves are unchanged, including exact fractional
120
- coordinates if present. Missing italic corrections are zero; missing accent attachments use half the advance.
120
+ coordinates if present. Missing italic corrections are zero. Missing accent attachments use half the advance.
121
121
  Assembly parts retain the OpenType order: bottom to top vertically, left to right horizontally. Latin Modern has
122
122
  no MATH Device adjustments. Hint programs and general text shaping tables are not used by the SVG renderer.
123
123
 
124
124
  The asset stores no per-glyph ink bounds. The decoder derives them from the outline with the arithmetic of fontTools'
125
- `BoundsPen`, operation for operation in IEEE double precision; for this font every derived bound equals the
125
+ `BoundsPen`, operation for operation in IEEE double precision. For this font every derived bound equals the
126
126
  value the 2.2.0 asset stored. The contour profiles earlier versions derived (ink edges in 32-unit strips) are
127
127
  gone from the asset since 2.6.0: layout places scripts by TeX's rules, and only the typesetting verifier
128
128
  measures ink gaps, deriving the same strips from each outline itself.
129
129
 
130
130
  LuaTeX 1.17.0's CFF loader uses Bézier control points to measure its font boxes. Most vertical glyphs have the same
131
- box under both rules; twelve of the 325 vertical bases and variants differ. `verticalBounds` preserves those twelve
131
+ box under both rules. Twelve of the 325 vertical bases and variants differ. `verticalBounds` preserves those twelve
132
132
  boxes, derived by fontTools' `ControlBoundsPen`, independently of the ink decoder. Large operators use the semantic
133
- height and depth when centering on the axis; ink extents and original paths remain unchanged. The affected large
133
+ height and depth when centering on the axis. Ink extents and original paths remain unchanged. The affected large
134
134
  operators are the small and large forms of `\bigtimes`, `\bigvee` and `\bigwedge`.
135
135
 
136
136
  Character mappings, optical substitutions, stretch constructions and record offsets
137
137
  occupy a compact index decoded at module load. Glyph metrics and outlines stay in independent raw DEFLATE pages
138
138
  until requested. Every page
139
139
  ends at a record boundary and contains at most 16,384 decoded bytes. The complete set of pages travels in the
140
- same asset; rare characters, stretch parts and optical forms require no additional download.
140
+ same asset. Rare characters, stretch parts and optical forms require no additional download.
141
141
 
142
142
  Outlines share exactly matching contours after translation. The 8,166 ordered contour references use 5,013
143
143
  unique contour records. A record either stores its original command structure and relative coordinates, or
144
144
  exact differences from an earlier contour with the same structure. Parent chains have at most four links.
145
145
  The generator prefers small coordinate differences as well as short records, because the smallest initial
146
146
  record does not necessarily produce the smallest compressed page. Glyph assembly restores the original
147
- absolute `M/L/H/V/C/Z` paths, including contour order; existing outline-part consumers use those commands.
148
- A contour whose closing curve ends at its start omits that end point; the decoder returns the curve to the start.
147
+ absolute `M/L/H/V/C/Z` paths, including contour order. Existing outline-part consumers use those commands.
148
+ A contour whose closing curve ends at its start omits that end point. The decoder returns the curve to the start.
149
149
 
150
150
  Glyph metrics use a reversible half-advance accent predictor with a median origin per metric field.
151
151
  They retain the complete original advance, italic and accent measurements. Signed record integers
152
152
  use zigzag values: values below 240 take one byte, the next 3,840 values take two bytes, and larger values use
153
- an escape followed by unsigned LEB128. The coordinate unit is exact; this encoding performs no quantization.
153
+ an escape followed by unsigned LEB128. The coordinate unit is exact. This encoding performs no quantization.
154
154
 
155
155
  Each inflated page and completed glyph record stays for the life of the module, so the font
156
156
  itself bounds these caches: the pages inflate to about 520 KB. Temporary parent coordinates and page views are
157
- discarded after a glyph is assembled; cached glyphs keep the completed path and metrics.
157
+ discarded after a glyph is assembled. Cached glyphs keep the completed path and metrics.
158
158
  These caches contain font data only. They retain no formula source, parse tree, layout result, SVG element or
159
159
  document. Returned internal records are read-only to consumers.
160
160
 
161
161
  The synchronous decoder checks compressed input, output size, record boundaries and parent depth. It requires
162
162
  no network, font installation, font parser or platform font shaping at runtime. `glyph` is an
163
- internal font accessor; the public parser and rendering API remain independent of this storage format.
163
+ internal font accessor. The public parser and rendering API remain independent of this storage format.
164
164
 
165
165
  The format follows the [OpenType MATH specification](https://learn.microsoft.com/en-us/typography/opentype/spec/math)
166
166
  and [RFC 1951](https://www.rfc-editor.org/rfc/rfc1951). The generator omits eight unconsumed constants:
@@ -2,10 +2,10 @@
2
2
  "spdxVersion": "SPDX-2.3",
3
3
  "dataLicense": "CC0-1.0",
4
4
  "SPDXID": "SPDXRef-DOCUMENT",
5
- "name": "rapier-math-3.0.0",
6
- "documentNamespace": "https://rapier.website/spdx/rapier-math-3.0.0-2825714cd36ab23353d28c7947666e28dee9a9bdbf62b10fd0a8ab342e69ee47",
5
+ "name": "rapier-math-3.1.0",
6
+ "documentNamespace": "https://rapier.website/spdx/rapier-math-3.1.0-f7513e9078e35bc7fe471960b6a5dc7822d80f7ad35e4321c5d2c131ea6c4ac7",
7
7
  "creationInfo": {
8
- "created": "2026-10-31T05:08:43.000Z",
8
+ "created": "2026-11-29T20:48:18.000Z",
9
9
  "creators": [
10
10
  "Tool: rapier-math-components",
11
11
  "Organization: rapier.website"
@@ -15,17 +15,17 @@
15
15
  {
16
16
  "name": "rapier-math",
17
17
  "SPDXID": "SPDXRef-rapier-math",
18
- "versionInfo": "3.0.0",
18
+ "versionInfo": "3.1.0",
19
19
  "downloadLocation": "NOASSERTION",
20
20
  "filesAnalyzed": false,
21
21
  "licenseConcluded": "MIT AND LicenseRef-GUST-Font-License",
22
22
  "licenseDeclared": "MIT AND LicenseRef-GUST-Font-License",
23
23
  "copyrightText": "NOASSERTION",
24
- "sourceInfo": "Verified public build inputs: docs/math-resources.json (SHA-256 d5d9b6b5c5320d97caf82ea1a3415def25b3ddfe1bb9f1a58d5f28b55aaa0bf8).",
24
+ "sourceInfo": "Verified public build inputs: docs/math-resources.json (SHA-256 6cd5acc62440cc4ced93312a4fea23bceda2660f4f23adb48693b1c420d6d434).",
25
25
  "checksums": [
26
26
  {
27
27
  "algorithm": "SHA256",
28
- "checksumValue": "2825714cd36ab23353d28c7947666e28dee9a9bdbf62b10fd0a8ab342e69ee47"
28
+ "checksumValue": "f7513e9078e35bc7fe471960b6a5dc7822d80f7ad35e4321c5d2c131ea6c4ac7"
29
29
  }
30
30
  ]
31
31
  },
@@ -1,12 +1,12 @@
1
1
  {
2
- "bundle": "rapier-math-3.0.0.js",
2
+ "bundle": "rapier-math-3.1.0.js",
3
3
  "packageBundle": "dist/rapier-math.js",
4
- "version": "3.0.0",
4
+ "version": "3.1.0",
5
5
  "license": "MIT AND LicenseRef-GUST-Font-License",
6
6
  "bytes": 742684,
7
7
  "gzipBytes": 421701,
8
- "sha256": "2825714cd36ab23353d28c7947666e28dee9a9bdbf62b10fd0a8ab342e69ee47",
9
- "sha384": "t7kbxrkzF1YSQz1jItY5cbSBCUaO5aV0PPaQ3tgWvIXXS2jRL9Oq/6TLazcPCpJr",
8
+ "sha256": "f7513e9078e35bc7fe471960b6a5dc7822d80f7ad35e4321c5d2c131ea6c4ac7",
9
+ "sha384": "ScqVpxxnEv66kw08gHxrm/D7ty17X3GlpuVoZUl5mA1okCGTCMNwUYdkKbqJn3bU",
10
10
  "sources": [
11
11
  {
12
12
  "file": "math/font.js",
@@ -90,7 +90,7 @@
90
90
  "file": "math/classic.js",
91
91
  "packageFile": "src/math/classic.js",
92
92
  "bytes": 269,
93
- "sha256": "c4d5fcbf318dd8ecb10871f67826111c2a436ca17f9065491e462eb721229857"
93
+ "sha256": "fd1f5b1096dd484b048638fab5ff149edbd9d5f0048cbf645e8b7a9f1ccf3288"
94
94
  }
95
95
  ],
96
96
  "recipe": [
@@ -103,8 +103,8 @@
103
103
  {
104
104
  "file": "math/FONT-SOURCE.md",
105
105
  "packageFile": "docs/font-source.md",
106
- "bytes": 12641,
107
- "sha256": "9827c9ab8e0b600f3b8646b0611819b68b52dc60b526aa39992a22111d9847eb"
106
+ "bytes": 12635,
107
+ "sha256": "18d22cc21724f7d150ea4642dc95a280966392303f1b6f42d7a0f407c0178e98"
108
108
  },
109
109
  {
110
110
  "file": "math/FONT-LICENSE.txt",
@@ -115,8 +115,8 @@
115
115
  {
116
116
  "file": "tools/build-math.mjs",
117
117
  "packageFile": "src/tools/build-math.mjs",
118
- "bytes": 11595,
119
- "sha256": "fc9b00db8882ebcc4fa316efd8a8749dab444926fc0f994b1e4ec32ffcd9ae18"
118
+ "bytes": 11626,
119
+ "sha256": "72b44fef13b3109a3e12552e164626aa1dcb64886ec181dd0b62d5c92ec581ea"
120
120
  },
121
121
  {
122
122
  "file": "math/LICENSE-MIT",
@@ -133,32 +133,38 @@
133
133
  {
134
134
  "file": "math/package-layout.mjs",
135
135
  "packageFile": "src/math/package-layout.mjs",
136
- "bytes": 925,
137
- "sha256": "72e90f365ff6ccf9741ab12a3bd9d7466389f1794c24b73dc86c831743923d36"
136
+ "bytes": 993,
137
+ "sha256": "b70a8b45112a7e7b3eb8a05a9837de39cbd8a50d7aefd140e91cb2b0e430cb4c"
138
138
  },
139
139
  {
140
140
  "file": "math/package-readme.mjs",
141
141
  "packageFile": "src/math/package-readme.mjs",
142
- "bytes": 1949,
143
- "sha256": "a852b158999d03ec6a4b2e479cb49bf246e9b8f14d4b54a86d67e32bf7b58bb1"
142
+ "bytes": 2095,
143
+ "sha256": "a72890e98766f6cebbbc860b1e773debd8e9a04dacff1af75e568c84cbdf579a"
144
144
  },
145
145
  {
146
146
  "file": "math/README.md",
147
147
  "packageFile": "docs/api.md",
148
- "bytes": 24187,
149
- "sha256": "636243ac6b4f9a5687359eaaa95abdd79ecc145a11ca0f9b393ff82166777bb4"
150
- },
151
- {
152
- "file": "math/CHANGELOG.md",
153
- "packageFile": "CHANGELOG.md",
154
- "bytes": 1024,
155
- "sha256": "4adf7ef95a37ca26ea3adfd98a6b2bef77120fa4b0cb2c45ad6eaa6c9d53b345"
148
+ "bytes": 24296,
149
+ "sha256": "fed96a04c7c39a71d814344e922e883a8492394aa8fea6ec58a11b283d2946ad"
156
150
  },
157
151
  {
158
152
  "file": "math/SEMANTICS.md",
159
153
  "packageFile": "docs/semantics.md",
160
154
  "bytes": 18413,
161
- "sha256": "e0cd9370ffe88a38658bd4de193002429ad202b772655a0e8c7104e426ba1519"
155
+ "sha256": "ead72ea53908d98dc81dc6f12f87b5e4a9498c8d908f3bcada116e990a9b7f98"
156
+ },
157
+ {
158
+ "file": "math/cli.mjs",
159
+ "packageFile": "dist/cli.mjs",
160
+ "bytes": 19282,
161
+ "sha256": "8b8f94baa894fc81a31f833a1e986ec7699d5763b7bbb590961542aee7cfabad"
162
+ },
163
+ {
164
+ "file": "math/skills/rapier-math/SKILL.md",
165
+ "packageFile": "skills/rapier-math/SKILL.md",
166
+ "bytes": 4916,
167
+ "sha256": "31a509e5388a15324d98be9b138cef44c53333b8e7280ca97217c393299c4413"
162
168
  }
163
169
  ],
164
170
  "components": [
@@ -206,14 +212,14 @@
206
212
  {
207
213
  "file": "math/delimiters.mjs",
208
214
  "packageFile": "dist/delimiters.mjs",
209
- "bytes": 1945,
210
- "sha256": "2847d23ba78534b32348d5e642ded601e4f6fd9c41e10d80c46955d440d24eba"
215
+ "bytes": 3283,
216
+ "sha256": "19dc9d5c0ce1051e6e1481e62d28c988c7d8fde1e85d68b6dcc41f8891da0461"
211
217
  },
212
218
  {
213
219
  "file": "math/markdown-rules.mjs",
214
220
  "packageFile": "dist/markdown-rules.mjs",
215
- "bytes": 6000,
216
- "sha256": "f0e8fd1e899c99e90293088dd17d4ed14d3ef9a3a1e6558d13f7ce66999ba67d"
221
+ "bytes": 6749,
222
+ "sha256": "3ef451b770756575674c44b16a27527e75c76a01517f4f6568da109ddee8fe69"
217
223
  },
218
224
  {
219
225
  "file": "math/reuse.mjs",
@@ -284,8 +290,8 @@
284
290
  {
285
291
  "file": "math/classic.d.ts",
286
292
  "packageFile": "dist/classic.d.ts",
287
- "bytes": 347,
288
- "sha256": "ce6c4d57a671e473a5a66c36a79b612f220954f49a624b22694311ca46a4be25"
293
+ "bytes": 305,
294
+ "sha256": "f1bad476b58469beb7feca3f92f5fc6a6f47b8a31c7031c0d027a843c2276182"
289
295
  },
290
296
  {
291
297
  "file": "math/delimiters.d.ts",
@@ -387,7 +393,7 @@
387
393
  "file": "math/examples/README.md",
388
394
  "packageFile": "examples/README.md",
389
395
  "bytes": 2881,
390
- "sha256": "97d7028dc1707b309abd073e59c98f94727ba89aa00177e69ed31b0720ba4d91"
396
+ "sha256": "fbe6ff6a4424856a9167f39444aa73ad7272fc01c130160ba68a38724cbd86e9"
391
397
  }
392
398
  ]
393
399
  }