rapier-math 2.7.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/README.md +23 -32
- package/dist/accessible.d.ts +2 -2
- package/dist/classic.d.ts +1 -2
- package/dist/cli.mjs +438 -0
- package/dist/combined.d.ts +2 -2
- package/dist/delimiters.mjs +56 -17
- package/dist/index.mjs +1 -1
- package/dist/integration.d.ts +1 -1
- package/dist/markdown-it.d.ts +2 -0
- package/dist/markdown-rules.mjs +22 -5
- package/dist/rapier-math.js +1 -1
- package/dist/rehype.d.ts +1 -1
- package/docs/api.md +53 -49
- package/docs/font-source.md +24 -24
- package/docs/formula-dark.svg +1 -0
- package/docs/formula-light.svg +1 -0
- package/docs/math-components.json +6 -6
- package/docs/math-resources.json +47 -41
- package/docs/semantics.md +39 -36
- package/examples/README.md +7 -7
- package/package.json +6 -3
- package/skills/rapier-math/SKILL.md +60 -0
- package/src/math/classic.js +1 -1
- package/src/math/package-layout.mjs +2 -2
- package/src/math/package-readme.mjs +23 -32
- package/src/tools/build-math.mjs +10 -3
- package/CHANGELOG.md +0 -10
package/dist/markdown-rules.mjs
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
// Original neutral adapter. The host owns Markdown structure and normalization.
|
|
3
3
|
import {createMathMatcher} from './delimiters.mjs';
|
|
4
4
|
|
|
5
|
+
function isMathFenceInfo(info) {
|
|
6
|
+
if (!info || info.length < 4) return false;
|
|
7
|
+
let start = 0;
|
|
8
|
+
const len = info.length;
|
|
9
|
+
while (start < len && info.charCodeAt(start) <= 0x20) start++;
|
|
10
|
+
if (start + 4 > len) return false;
|
|
11
|
+
if ((info.charCodeAt(start) | 32) !== 0x6d ||
|
|
12
|
+
(info.charCodeAt(start + 1) | 32) !== 0x61 ||
|
|
13
|
+
(info.charCodeAt(start + 2) | 32) !== 0x74 ||
|
|
14
|
+
(info.charCodeAt(start + 3) | 32) !== 0x68) return false;
|
|
15
|
+
return start + 4 === len || info.charCodeAt(start + 4) <= 0x20;
|
|
16
|
+
}
|
|
17
|
+
|
|
5
18
|
export function installMathRules(md, {singleDollar = false, brackets = true, ruleName = 'rapier_math', inLink = false} = {}) {
|
|
6
19
|
// Block tokens share their core owner's array, including nested quotes/lists. Capture
|
|
7
20
|
// fence source while the host still holds those containers' adjusted line bounds.
|
|
@@ -12,15 +25,17 @@ export function installMathRules(md, {singleDollar = false, brackets = true, rul
|
|
|
12
25
|
md.core.ruler.after('block', ruleName + '_source_release', state => authored.delete(state.tokens));
|
|
13
26
|
const tokenize = md.block.tokenize;
|
|
14
27
|
md.block.tokenize = function(state, startLine, endLine) {
|
|
28
|
+
// Tokens before this call are already scanned. A yielding host empties the list between block windows, so a
|
|
29
|
+
// count kept from an earlier window would skip the fences of the next.
|
|
15
30
|
const first = state.tokens.length;
|
|
16
31
|
// A yielding host can leave tokenize at a completed block boundary by throwing.
|
|
17
32
|
// Retain those completed fences before that boundary releases its line tables.
|
|
18
33
|
try { return tokenize.call(this, state, startLine, endLine); }
|
|
19
34
|
finally {
|
|
20
|
-
|
|
35
|
+
const len = state.tokens.length;
|
|
36
|
+
for (let index = first; index < len; index++) {
|
|
21
37
|
const token = state.tokens[index];
|
|
22
|
-
if (token.type !== 'fence' || !token.map || token.meta?.mathSource !== undefined ||
|
|
23
|
-
String(token.info || '').trim().split(/\s+/)[0].toLowerCase() !== 'math') continue;
|
|
38
|
+
if (token.type !== 'fence' || !token.map || token.meta?.mathSource !== undefined || !isMathFenceInfo(token.info)) continue;
|
|
24
39
|
const held = authored.get(state.tokens), source = held?.source ?? state.src;
|
|
25
40
|
let value;
|
|
26
41
|
if (!state.rapierSourceSlice && source === state.src) value = state.getLines(token.map[0], token.map[1], state.blkIndent, false);
|
|
@@ -70,7 +85,8 @@ export function installMathRules(md, {singleDollar = false, brackets = true, rul
|
|
|
70
85
|
}
|
|
71
86
|
md.inline.ruler.before('escape', ruleName, (state, silent) => {
|
|
72
87
|
if (!inLink && state.linkLevel > 0) return false;
|
|
73
|
-
|
|
88
|
+
const ch = state.src.charCodeAt(state.pos);
|
|
89
|
+
if (ch !== 0x24 && (!brackets || ch !== 0x5c)) return false;
|
|
74
90
|
const span = match(state, state.pos, state.posMax);
|
|
75
91
|
if (!span) return false;
|
|
76
92
|
if (!silent) {
|
|
@@ -86,7 +102,8 @@ export function installMathRules(md, {singleDollar = false, brackets = true, rul
|
|
|
86
102
|
// An indented code block belongs to the host even when it begins with dollars.
|
|
87
103
|
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
88
104
|
const start = state.bMarks[startLine] + state.tShift[startLine];
|
|
89
|
-
|
|
105
|
+
const c0 = state.src.charCodeAt(start), c1 = state.src.charCodeAt(start + 1);
|
|
106
|
+
if (!(c0 === 0x24 && c1 === 0x24) && (!brackets || !(c0 === 0x5c && c1 === 0x5b))) return false;
|
|
90
107
|
const span = match(state, start, state.eMarks[endLine - 1]);
|
|
91
108
|
if (!span?.displayMode) return false;
|
|
92
109
|
let last = startLine;
|
package/dist/rapier-math.js
CHANGED
|
@@ -4451,7 +4451,7 @@ function mathRenderWithMathML(source, options = {}) {
|
|
|
4451
4451
|
|
|
4452
4452
|
// SPDX-License-Identifier: MIT
|
|
4453
4453
|
globalThis.RapierMath=Object.freeze({
|
|
4454
|
-
version:'
|
|
4454
|
+
version:'3.1.0', parse:parseMathTex,
|
|
4455
4455
|
render:renderMath, renderToString:mathRenderToString,
|
|
4456
4456
|
fit:mathFit, observe:mathObserve,
|
|
4457
4457
|
toMathML:mathToMathML, renderWithMathML:mathRenderWithMathML,
|
package/dist/rehype.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ declare module 'vfile' {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
/** Install after sanitization. Recognizes remark-rehype math code nodes. */
|
|
13
|
-
export default function rehypeRapierMath(options?: IntegrationOptions): (tree: Root, file
|
|
13
|
+
export default function rehypeRapierMath(options?: IntegrationOptions): (tree: Root, file?: VFile) => void;
|
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
|
-
|
|
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
|
|
23
|
-
the TeX a second time. Native ESM works in Node 22+, current browsers and module workers
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
158
|
-
holding the replacement. Cancel transport as well. `abort` closes a handle and releases its pending work
|
|
159
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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}
|
|
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
|
|
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
|
|
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
|
|
260
|
-
SSR and the initial hydration render. Long rows break at available relations/operators
|
|
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,24 +276,25 @@ 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
|
|
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"
|
|
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
|
|
286
288
|
alternatives and diagnostics, is capped at 24 Mi UTF-16 code units. These are output/work bounds, not peak
|
|
287
289
|
heap or device-memory claims. A later good render has a fresh budget.
|
|
288
290
|
|
|
289
|
-
SVG labels contain raw TeX, not
|
|
290
|
-
the accessibility tree. Equations
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
291
|
+
SVG-only output labels contain raw TeX, not MathML or mathematical speech. Ordinary SVG equations are images in
|
|
292
|
+
the accessibility tree. Equations with authored HTTP(S) links use a group so the links remain exposed,
|
|
293
|
+
keyboard-focusable and labeled with their destinations. Use `rapier-math/mathml` for structured MathML or
|
|
294
|
+
`rapier-math/accessible` with `rapier-math/accessible.css` for MathML-backed presentation. See
|
|
295
|
+
[MathML and accessibility](semantics.md). Keep editable source or a copy-source control in the host.
|
|
296
|
+
Mathematical speech, navigation and screen-reader parity still need host testing. Improving SVG-only
|
|
297
|
+
accessibility remains future work.
|
|
295
298
|
|
|
296
299
|
## Security and deployment
|
|
297
300
|
|
|
@@ -303,20 +306,20 @@ escaped text rendering. Formula safety does not sanitize surrounding Markdown.
|
|
|
303
306
|
The native ESM path needs no `eval` or `unsafe-eval`. Generated SVG does contain style attributes:
|
|
304
307
|
`script-src 'self'; style-src-attr 'unsafe-inline'; style-src-elem 'none'` permits same-origin external
|
|
305
308
|
modules and those attributes in browsers implementing CSP3. It does **not** work under a policy forbidding
|
|
306
|
-
all inline styles. `examples/browser.html` carries that policy
|
|
307
|
-
style policy. No network access is needed after local module loading
|
|
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.
|
|
308
311
|
|
|
309
312
|
With `require-trusted-types-for 'script'`, string HTML sinks and the DOMParser used by `fit`/`observe`
|
|
310
313
|
require TrustedHTML. The core does not create a policy, return TrustedHTML or claim fitting support under
|
|
311
314
|
that policy. Prefer server-rendered output or the structured rehype path in such applications. If the host
|
|
312
|
-
uses a policy for initial insertion, narrowly scope it to freshly generated renderer output
|
|
315
|
+
uses a policy for initial insertion, narrowly scope it to freshly generated renderer output. Never use a
|
|
313
316
|
blanket identity policy for arbitrary strings. The browser/React examples assume string sinks are permitted.
|
|
314
317
|
|
|
315
318
|
## Syntax and limits
|
|
316
319
|
|
|
317
320
|
Supported: fractions, roots, scripts, limits, matrices/arrays/alignment, delimiters, accents, operators,
|
|
318
321
|
Greek and mathematical alphabets, text/color/size/spacing, local macros, and selected chemistry/physics.
|
|
319
|
-
Existing supported package names select built-in syntax
|
|
322
|
+
Existing supported package names select built-in syntax. There is no external package/file loader.
|
|
320
323
|
This is not a complete TeX document engine. No automatic numbering or cross-formula reference guarantee.
|
|
321
324
|
Unsupported commands give diagnostics. Lowercase script/bold-script requests use ordinary-letter fallbacks
|
|
322
325
|
where Latin Modern lacks those alphabets. All embedded licensed outlines remain present. Letters, digits
|
|
@@ -326,18 +329,19 @@ the reader's own serif font, fitted to an estimated width, rather than refused.
|
|
|
326
329
|
## Package and proof
|
|
327
330
|
|
|
328
331
|
Declarations accompany every public entry. Formula imports do not pull in Markdown, unified or React.
|
|
329
|
-
For TypeScript, markdown-it 15 provides its own types
|
|
332
|
+
For TypeScript, markdown-it 15 provides its own types. Markdown-it 14 projects also install
|
|
330
333
|
`@types/markdown-it@14`. Use the declarations for your host version.
|
|
331
334
|
For a classic script, use `dist/rapier-math.js` and `globalThis.RapierMath`.
|
|
332
335
|
The payload includes the font: it is not a few-kilobyte renderer. Payload counts below describe this
|
|
333
336
|
build, not npm tarball size or a comparison against another library.
|
|
334
337
|
|
|
335
|
-
Run `node
|
|
336
|
-
classic payload and ESM
|
|
338
|
+
Run `node src/tools/build-math.mjs --package .` from the installed package directory. The carried source rebuilds the
|
|
339
|
+
classic payload and ESM modules and updates their source receipt and component provenance. The receipt also covers
|
|
340
|
+
the adapters, declarations and examples. Follow
|
|
337
341
|
`docs/font-source.md` to regenerate font data. License and font provenance are carried with every build.
|
|
338
342
|
|
|
339
|
-
Verified-claim scope: synchronous self-contained formula rendering
|
|
340
|
-
replaceable previews with exact final source
|
|
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
|
|
341
345
|
does not establish all-device behavior, full TeX compatibility, semantic accessibility or universal
|
|
342
346
|
size/speed superiority. Test your host's sanitizer, CSP, browser lifetime and supported formula corpus.
|
|
343
347
|
|
package/docs/font-source.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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>.
|
|
@@ -42,10 +42,10 @@ The generated asset uses Python 3.12, fontTools 4.61.1, Brotli 1.1.0 and zlib 1.
|
|
|
42
42
|
|
|
43
43
|
```sh
|
|
44
44
|
python -m pip install fonttools==4.61.1 Brotli==1.1.0
|
|
45
|
-
python
|
|
45
|
+
python src/math/build-font.py
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
To regenerate without network access, supply the
|
|
49
49
|
exact inputs with `--font`, `--mono-font`, `--hook-font`, `--license`, `--lppl` and `--text-font`. `--out` selects the JavaScript path and writes
|
|
50
50
|
the combined license beside it. When available, the generator uses the editor's local Geist font.
|
|
51
51
|
|
|
@@ -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
|
|
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
|
|
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
|
|
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 `tools/build-math.mjs
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
148
|
-
A contour whose closing curve ends at its start omits that end point
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" role="img" aria-label="x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}" data-rapier-math="display" data-math-lines="1" data-math-natural-width="9.053744" width="9.053744em" height="2.3804em" viewBox="-25 -1658.4 9053.744444 2380.4" style="font-size:1.229698em;max-width:100%;height:auto;vertical-align:-0.722em;fill-opacity:1;stroke-opacity:1" fill="#fff"><title>x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}</title><g transform="scale(1000)"><path d="M527 376C527 428 468 442 434 442C376 442 341 389 329 366C304 432 250 442 221 442C117 442 60 313 60 288C60 278 72 278 72 278C80 278 83 280 85 289C119 395 185 420 219 420C238 420 273 411 273 353C273 322 256 255 219 115C203 53 168 11 124 11C118 11 95 11 74 24C99 29 121 50 121 78C121 105 99 113 84 113C54 113 29 87 29 55C29 9 79 -11 123 -11C189 -11 225 59 228 65C240 28 276 -11 336 -11C439 -11 496 118 496 143C496 153 487 153 484 153C475 153 473 149 471 142C438 35 370 11 338 11C299 11 283 43 283 77C283 99 289 121 300 165L334 302C340 328 363 420 433 420C438 420 462 420 483 407C455 402 435 377 435 353C435 337 446 318 473 318C495 318 527 336 527 376Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.849778 0)"><path d="M722 347C722 358 713 367 702 367H76C65 367 56 358 56 347C56 336 65 327 76 327H702C713 327 722 336 722 347ZM722 153C722 164 713 173 702 173H76C65 173 56 164 56 153C56 142 65 133 76 133H702C713 133 722 142 722 153Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(1.905556 0)"><g transform="translate(0.12 -0.677)"><path d="M722 250C722 261 713 270 702 270H76C65 270 56 261 56 250C56 239 65 230 76 230H702C713 230 722 239 722 250Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.778 0)"><path d="M415 282C415 373 362 442 282 442C236 442 195 413 165 382L239 683C239 683 239 694 226 694C203 694 130 686 104 684C96 683 85 682 85 664C85 652 94 652 109 652C157 652 159 645 159 635C159 628 150 594 145 573L63 247C51 197 47 181 47 146C47 51 100 -11 174 -11C292 -11 415 138 415 282ZM343 326C343 267 310 152 292 114C259 47 213 11 174 11C140 11 107 38 107 112C107 131 107 150 123 213L145 305C151 327 151 329 160 340C209 405 254 420 280 420C316 420 343 390 343 326Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(1.443222 0)"><path d="M722 -64C722 -53 713 -44 702 -44H409V230H702C713 230 722 239 722 250C722 261 713 270 702 270H409V563C409 574 400 583 389 583C378 583 369 574 369 563V270H76C65 270 56 261 56 250C56 239 65 230 76 230H369V-44H76C65 -44 56 -53 56 -64C56 -75 65 -84 76 -84H702C713 -84 722 -75 722 -64Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(2.443444 0)"><g transform="translate(0 -0.8764)"><path d="M853 20C853 31 845 40 833 40C821 40 818 33 812 21L389 -855L211 -463C207 -455 205 -449 198 -449C195 -449 193 -449 184 -457L85 -532C74 -541 73 -542 73 -546C73 -553 77 -557 83 -557C86 -557 88 -557 97 -549L149 -510L347 -945C353 -959 355 -960 366 -960C382 -960 384 -956 391 -941L847 3C852 14 853 15 853 20Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(0.833 0)"><path d="M415 282C415 373 362 442 282 442C236 442 195 413 165 382L239 683C239 683 239 694 226 694C203 694 130 686 104 684C96 683 85 682 85 664C85 652 94 652 109 652C157 652 159 645 159 635C159 628 150 594 145 573L63 247C51 197 47 181 47 146C47 51 100 -11 174 -11C292 -11 415 138 415 282ZM343 326C343 267 310 152 292 114C259 47 213 11 174 11C140 11 107 38 107 112C107 131 107 150 123 213L145 305C151 327 151 329 160 340C209 405 254 420 280 420C316 420 343 390 343 326Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.443 -0.289)"><path d="M505 182H471C468 160 458 101 445 91C437 85 360 85 346 85H162C267 178 302 206 362 253C436 312 505 374 505 469C505 590 399 664 271 664C147 664 63 577 63 485C63 434 106 429 116 429C140 429 169 446 169 482C169 500 162 535 110 535C141 606 209 628 256 628C356 628 408 550 408 469C408 382 346 313 314 277L73 39C63 30 63 28 63 0H475Z" transform="scale(0.0007 -0.0007)"/></g><g transform="translate(1.119522 0)"><path d="M722 250C722 261 713 270 702 270H76C65 270 56 261 56 250C56 239 65 230 76 230H702C713 230 722 239 722 250Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(2.119744 0)"><path d="M471 165V196H371V651C371 671 371 677 355 677C346 677 343 677 335 665L28 196V165H294V78C294 42 292 31 218 31H197V0C238 3 290 3 332 3C374 3 427 3 468 0V31H447C373 31 371 42 371 78V165ZM300 196H56L300 569Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(2.619744 0)"><path d="M498 143C498 153 489 153 486 153C476 153 475 149 472 135C455 70 437 11 396 11C369 11 366 37 366 57C366 79 368 87 379 131L401 221L437 361C444 389 444 391 444 395C444 412 432 422 415 422C391 422 376 400 373 378C355 415 326 442 281 442C164 442 40 295 40 149C40 55 95 -11 173 -11C193 -11 243 -7 303 64C311 22 346 -11 394 -11C429 -11 452 12 468 44C485 80 498 143 498 143ZM361 332C361 326 359 320 358 315L308 119C303 101 303 99 288 82C244 27 203 11 175 11C125 11 111 66 111 105C111 155 143 278 166 324C197 383 242 420 282 420C347 420 361 338 361 332Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(3.148744 0)"><path d="M430 107C430 113 424 120 418 120C413 120 411 118 405 110C326 11 217 11 205 11C142 11 115 60 115 120C115 161 135 258 169 320C200 377 255 420 310 420C344 420 382 407 396 380C380 380 366 380 352 366C336 351 334 334 334 327C334 303 352 292 371 292C400 292 427 316 427 356C427 405 380 442 309 442C174 442 41 299 41 158C41 68 99 -11 203 -11C346 -11 430 95 430 107Z" transform="scale(0.001 -0.001)"/></g></g><g transform="translate(0.833 0)"><path data-math-rule="" d="M0 -0.9164H3.581744v0.04H0Z"/></g></g></g><g transform="translate(3.034594 0.686)"><path d="M449 174H424C419 144 412 100 402 85C395 77 329 77 307 77H127L233 180C389 318 449 372 449 472C449 586 359 666 237 666C124 666 50 574 50 485C50 429 100 429 103 429C120 429 155 441 155 482C155 508 137 534 102 534C94 534 92 534 89 533C112 598 166 635 224 635C315 635 358 554 358 472C358 392 308 313 253 251L61 37C50 26 50 24 50 0H421Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.5 0)"><path d="M498 143C498 153 489 153 486 153C476 153 475 149 472 135C455 70 437 11 396 11C369 11 366 37 366 57C366 79 368 87 379 131L401 221L437 361C444 389 444 391 444 395C444 412 432 422 415 422C391 422 376 400 373 378C355 415 326 442 281 442C164 442 40 295 40 149C40 55 95 -11 173 -11C193 -11 243 -7 303 64C311 22 346 -11 394 -11C429 -11 452 12 468 44C485 80 498 143 498 143ZM361 332C361 326 359 320 358 315L308 119C303 101 303 99 288 82C244 27 203 11 175 11C125 11 111 66 111 105C111 155 143 278 166 324C197 383 242 420 282 420C347 420 361 338 361 332Z" transform="scale(0.001 -0.001)"/></g></g><g transform="translate(0.12 0)"><path data-math-rule="" d="M0 -0.27H6.858189v0.04H0Z"/></g></g></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" role="img" aria-label="x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}" data-rapier-math="display" data-math-lines="1" data-math-natural-width="9.053744" width="9.053744em" height="2.3804em" viewBox="-25 -1658.4 9053.744444 2380.4" style="font-size:1.229698em;max-width:100%;height:auto;vertical-align:-0.722em;fill-opacity:1;stroke-opacity:1" fill="#000"><title>x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}</title><g transform="scale(1000)"><path d="M527 376C527 428 468 442 434 442C376 442 341 389 329 366C304 432 250 442 221 442C117 442 60 313 60 288C60 278 72 278 72 278C80 278 83 280 85 289C119 395 185 420 219 420C238 420 273 411 273 353C273 322 256 255 219 115C203 53 168 11 124 11C118 11 95 11 74 24C99 29 121 50 121 78C121 105 99 113 84 113C54 113 29 87 29 55C29 9 79 -11 123 -11C189 -11 225 59 228 65C240 28 276 -11 336 -11C439 -11 496 118 496 143C496 153 487 153 484 153C475 153 473 149 471 142C438 35 370 11 338 11C299 11 283 43 283 77C283 99 289 121 300 165L334 302C340 328 363 420 433 420C438 420 462 420 483 407C455 402 435 377 435 353C435 337 446 318 473 318C495 318 527 336 527 376Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.849778 0)"><path d="M722 347C722 358 713 367 702 367H76C65 367 56 358 56 347C56 336 65 327 76 327H702C713 327 722 336 722 347ZM722 153C722 164 713 173 702 173H76C65 173 56 164 56 153C56 142 65 133 76 133H702C713 133 722 142 722 153Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(1.905556 0)"><g transform="translate(0.12 -0.677)"><path d="M722 250C722 261 713 270 702 270H76C65 270 56 261 56 250C56 239 65 230 76 230H702C713 230 722 239 722 250Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.778 0)"><path d="M415 282C415 373 362 442 282 442C236 442 195 413 165 382L239 683C239 683 239 694 226 694C203 694 130 686 104 684C96 683 85 682 85 664C85 652 94 652 109 652C157 652 159 645 159 635C159 628 150 594 145 573L63 247C51 197 47 181 47 146C47 51 100 -11 174 -11C292 -11 415 138 415 282ZM343 326C343 267 310 152 292 114C259 47 213 11 174 11C140 11 107 38 107 112C107 131 107 150 123 213L145 305C151 327 151 329 160 340C209 405 254 420 280 420C316 420 343 390 343 326Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(1.443222 0)"><path d="M722 -64C722 -53 713 -44 702 -44H409V230H702C713 230 722 239 722 250C722 261 713 270 702 270H409V563C409 574 400 583 389 583C378 583 369 574 369 563V270H76C65 270 56 261 56 250C56 239 65 230 76 230H369V-44H76C65 -44 56 -53 56 -64C56 -75 65 -84 76 -84H702C713 -84 722 -75 722 -64Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(2.443444 0)"><g transform="translate(0 -0.8764)"><path d="M853 20C853 31 845 40 833 40C821 40 818 33 812 21L389 -855L211 -463C207 -455 205 -449 198 -449C195 -449 193 -449 184 -457L85 -532C74 -541 73 -542 73 -546C73 -553 77 -557 83 -557C86 -557 88 -557 97 -549L149 -510L347 -945C353 -959 355 -960 366 -960C382 -960 384 -956 391 -941L847 3C852 14 853 15 853 20Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(0.833 0)"><path d="M415 282C415 373 362 442 282 442C236 442 195 413 165 382L239 683C239 683 239 694 226 694C203 694 130 686 104 684C96 683 85 682 85 664C85 652 94 652 109 652C157 652 159 645 159 635C159 628 150 594 145 573L63 247C51 197 47 181 47 146C47 51 100 -11 174 -11C292 -11 415 138 415 282ZM343 326C343 267 310 152 292 114C259 47 213 11 174 11C140 11 107 38 107 112C107 131 107 150 123 213L145 305C151 327 151 329 160 340C209 405 254 420 280 420C316 420 343 390 343 326Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.443 -0.289)"><path d="M505 182H471C468 160 458 101 445 91C437 85 360 85 346 85H162C267 178 302 206 362 253C436 312 505 374 505 469C505 590 399 664 271 664C147 664 63 577 63 485C63 434 106 429 116 429C140 429 169 446 169 482C169 500 162 535 110 535C141 606 209 628 256 628C356 628 408 550 408 469C408 382 346 313 314 277L73 39C63 30 63 28 63 0H475Z" transform="scale(0.0007 -0.0007)"/></g><g transform="translate(1.119522 0)"><path d="M722 250C722 261 713 270 702 270H76C65 270 56 261 56 250C56 239 65 230 76 230H702C713 230 722 239 722 250Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(2.119744 0)"><path d="M471 165V196H371V651C371 671 371 677 355 677C346 677 343 677 335 665L28 196V165H294V78C294 42 292 31 218 31H197V0C238 3 290 3 332 3C374 3 427 3 468 0V31H447C373 31 371 42 371 78V165ZM300 196H56L300 569Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(2.619744 0)"><path d="M498 143C498 153 489 153 486 153C476 153 475 149 472 135C455 70 437 11 396 11C369 11 366 37 366 57C366 79 368 87 379 131L401 221L437 361C444 389 444 391 444 395C444 412 432 422 415 422C391 422 376 400 373 378C355 415 326 442 281 442C164 442 40 295 40 149C40 55 95 -11 173 -11C193 -11 243 -7 303 64C311 22 346 -11 394 -11C429 -11 452 12 468 44C485 80 498 143 498 143ZM361 332C361 326 359 320 358 315L308 119C303 101 303 99 288 82C244 27 203 11 175 11C125 11 111 66 111 105C111 155 143 278 166 324C197 383 242 420 282 420C347 420 361 338 361 332Z" transform="scale(0.001 -0.001)"/></g><g transform="translate(3.148744 0)"><path d="M430 107C430 113 424 120 418 120C413 120 411 118 405 110C326 11 217 11 205 11C142 11 115 60 115 120C115 161 135 258 169 320C200 377 255 420 310 420C344 420 382 407 396 380C380 380 366 380 352 366C336 351 334 334 334 327C334 303 352 292 371 292C400 292 427 316 427 356C427 405 380 442 309 442C174 442 41 299 41 158C41 68 99 -11 203 -11C346 -11 430 95 430 107Z" transform="scale(0.001 -0.001)"/></g></g><g transform="translate(0.833 0)"><path data-math-rule="" d="M0 -0.9164H3.581744v0.04H0Z"/></g></g></g><g transform="translate(3.034594 0.686)"><path d="M449 174H424C419 144 412 100 402 85C395 77 329 77 307 77H127L233 180C389 318 449 372 449 472C449 586 359 666 237 666C124 666 50 574 50 485C50 429 100 429 103 429C120 429 155 441 155 482C155 508 137 534 102 534C94 534 92 534 89 533C112 598 166 635 224 635C315 635 358 554 358 472C358 392 308 313 253 251L61 37C50 26 50 24 50 0H421Z" transform="scale(0.001 -0.001)"/><g transform="translate(0.5 0)"><path d="M498 143C498 153 489 153 486 153C476 153 475 149 472 135C455 70 437 11 396 11C369 11 366 37 366 57C366 79 368 87 379 131L401 221L437 361C444 389 444 391 444 395C444 412 432 422 415 422C391 422 376 400 373 378C355 415 326 442 281 442C164 442 40 295 40 149C40 55 95 -11 173 -11C193 -11 243 -7 303 64C311 22 346 -11 394 -11C429 -11 452 12 468 44C485 80 498 143 498 143ZM361 332C361 326 359 320 358 315L308 119C303 101 303 99 288 82C244 27 203 11 175 11C125 11 111 66 111 105C111 155 143 278 166 324C197 383 242 420 282 420C347 420 361 338 361 332Z" transform="scale(0.001 -0.001)"/></g></g><g transform="translate(0.12 0)"><path data-math-rule="" d="M0 -0.27H6.858189v0.04H0Z"/></g></g></g></svg>
|
|
@@ -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-
|
|
6
|
-
"documentNamespace": "https://rapier.website/spdx/rapier-math-
|
|
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-
|
|
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": "
|
|
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
|
|
24
|
+
"sourceInfo": "Verified public build inputs: docs/math-resources.json (SHA-256 6cd5acc62440cc4ced93312a4fea23bceda2660f4f23adb48693b1c420d6d434).",
|
|
25
25
|
"checksums": [
|
|
26
26
|
{
|
|
27
27
|
"algorithm": "SHA256",
|
|
28
|
-
"checksumValue": "
|
|
28
|
+
"checksumValue": "f7513e9078e35bc7fe471960b6a5dc7822d80f7ad35e4321c5d2c131ea6c4ac7"
|
|
29
29
|
}
|
|
30
30
|
]
|
|
31
31
|
},
|