rapier-markdown-kit 1.2.5 → 1.2.6

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/LICENSE CHANGED
@@ -20,7 +20,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
- Files under this licence carry `SPDX-License-Identifier: MIT` in their first lines: the standard's
23
+ Files under this license carry `SPDX-License-Identifier: MIT` in their first lines: the standard's
24
24
  grammar, marks and reference style (`spec/md-layout.mjs`, `spec/md-marks.mjs`, `spec/md-source.mjs`, `spec/flowchart.mjs`, `spec/markdown-style.css`), ink geometry
25
25
  (`spec/ink.mjs`),
26
26
  the layout model and line planner (`layout/model.mjs`, `layout/line-plan.mjs`, `layout/typography.mjs`, `layout/preparation.mjs`,
@@ -42,8 +42,8 @@ AGPL-3.0-only. The page wrapper (`skills/rapier-html/wrap.mjs`, `skills/rapier-h
42
42
  `kit/pdf-vectors.mjs`, `kit/pdf-glyphs.mjs`, `kit/stage.mjs` and MIT-marked conformance
43
43
  modules are covered too. These names describe the Rapier-owned files carrying the
44
44
  MIT notice, not a grant over the editor or third-party code. Other Rapier-owned
45
- files retain their stated licence; the editor is AGPL-3.0-only (see `LICENSE`).
46
- Third-party components retain their own copyright and licence notices.
45
+ files retain their stated license; the editor is AGPL-3.0-only (see `LICENSE`).
46
+ Third-party components retain their own copyright and license notices.
47
47
 
48
48
  The portable font helpers read document definitions and accept explicit host validation and
49
49
  subsetting functions. The application binding (`editor/export-fonts.mjs`), captured-font
package/README.md CHANGED
@@ -4,7 +4,7 @@ Read, render and write Self-contained Markdown in browsers and Node: one `.md` f
4
4
  drawings, layout and precise inline typography. Build portable documents for people and agents. Will/1 regions mark what an agent
5
5
  may edit, append to or preserve. MIT, no dependencies.
6
6
 
7
- - Typography uses ordinary inline HTML spans with validated size, colour and family. Comments and references
7
+ - Typography uses ordinary inline HTML spans with validated size, color and family. Comments and references
8
8
  carry other optional facts; each reader chooses its HTML, style, extension and resource support.
9
9
  - One stylesheet renders the document as the editor and its exported page do.
10
10
  - The line planner flows text around a picture's real shape; a conformance suite of thirteen documents runs
@@ -93,7 +93,7 @@ DOM objects between document realms.
93
93
 
94
94
  This **DOM-hosted library** requires a DOM and sanitizer, the Rapier grammar,
95
95
  portable image preparation, style access and the named codec/layout ports it uses.
96
- Those dependencies keep their own licences: the MIT grant here does not relicense a
96
+ Those dependencies keep their own licenses: the MIT grant here does not relicense a
97
97
  separately supplied host or vendor. The [editor host binding](https://github.com/jackskip22/rapier/blob/main/src/editor/render-host.js)
98
98
  lists the renderer's dependencies. [rapier-server](https://github.com/jackskip22/rapier/blob/main/server/README.md)
99
99
  provides a complete local host with a pinned Chromium process. Its Word exporter and filesystem service are AGPL,
@@ -118,7 +118,7 @@ Browser hosts additionally check the exact captured container with an uninstalle
118
118
  Without `FontFace`, only the host validator's admission is established; it does not establish
119
119
  browser container support. The HTML font helpers do not bundle the application's font importer,
120
120
  container codecs or subsetter. Rapier binds its existing materializer and shared importer at `editor/render-host.js` through
121
- `editor/export-fonts.mjs`; those implementations retain their application licence.
121
+ `editor/export-fonts.mjs`; those implementations retain their application license.
122
122
  An embedded family named Geist or Geist Mono remains custom data and takes precedence over the
123
123
  factory family. Custom fonts have no optional factory size limit.
124
124
 
@@ -140,7 +140,7 @@ family name share the host's font namespace. Print retains its existing factory
140
140
  | Import | What it is |
141
141
  | --- | --- |
142
142
  | `rapier-markdown-kit/layout` | The `md-layout:v1` comment a picture carries: parse it, validate it, write it back. |
143
- | `rapier-markdown-kit/marks` | Unified typography values, span writer and parser installer; preserved colour/font comments, ink and page breaks. |
143
+ | `rapier-markdown-kit/marks` | Unified typography values, span writer and parser installer; preserved color/font comments, ink and page breaks. |
144
144
  | `rapier-markdown-kit/model` | Occupancy profiles and the line planner: the wrapping itself. |
145
145
  | `rapier-markdown-kit/typography` | Source-preserving paragraph refinement through `createTypography()`. |
146
146
  | `rapier-markdown-kit/will` | The Will/1 grammar (a separate, optional standard): the markers around an agent's intent regions. |
@@ -244,11 +244,11 @@ font-data authority, including a name that collides with a factory face.
244
244
  inline span; split block selections and keep their `#`, list markers and separators outside. `typography.parseStyle`
245
245
  returns only admitted facts. `typography.install(md)` installs that interpretation on the caller's markdown-it
246
246
  parser, and `typographySourceRanges(source, md)` reports original UTF-16 wrapper ranges through that parser.
247
- These calls neither mutate the source nor load resources. The installer also reads already-authored colour and
247
+ These calls neither mutate the source nor load resources. The installer also reads already-authored color and
248
248
  font comments into the same facts; an ordinary open/save must preserve their bytes, not rewrite them as spans.
249
249
 
250
250
  Sizes accept positive decimal `pt`/`px`, at most 12 fractional digits, up to 1638pt/2184px; 96px = 72pt. New values
251
- use lowercase units and omit insignificant zeros. Colours become lowercase six-digit RGB hex; opaque integer
251
+ use lowercase units and omit insignificant zeros. Colors become lowercase six-digit RGB hex; opaque integer
252
252
  RGB CSSOM values are also read. Families are one validated name, an unquoted CSS generic, or an existing preset
253
253
  stack. `sans`, `serif`, `mono`, `system`, `hand` are reserved choice aliases, not quoted custom identities. Styles
254
254
  are bounded to 4096 characters, 32 declarations and 64 paired levels. Invalid declarations and unknown properties
@@ -271,7 +271,7 @@ unit, independent of editor zoom. No mapping claims identical glyphs or line bre
271
271
  See the original [typography guidance](https://github.com/jackskip22/rapier/blob/main/docs/markdown-standard.md#inline-typography),
272
272
  [CommonMark raw HTML](https://spec.commonmark.org/0.31.2/#raw-html), [CSS absolute units](https://www.w3.org/TR/css-values-4/#absolute-lengths),
273
273
  [Pandoc spans](https://pandoc.org/MANUAL.html#extension-bracketed_spans) and [Quarto spans](https://quarto.org/docs/authoring/markdown-basics.html#divs-and-spans).
274
- Those specifications retain their own licences.
274
+ Those specifications retain their own licenses.
275
275
 
276
276
  ## Render with the reference style
277
277
 
@@ -351,9 +351,9 @@ export const exampleSource = [
351
351
  'plain code',
352
352
  '~~~',
353
353
  '',
354
- 'A centred paragraph.' + formatLayout({align: 'center'}),
354
+ 'A centered paragraph.' + formatLayout({align: 'center'}),
355
355
  '',
356
- 'A ' + formatColorRun(TEXT_COLOR_NAMES.blue, 'blue phrase') + ' keeps its colour.',
356
+ 'A ' + formatColorRun(TEXT_COLOR_NAMES.blue, 'blue phrase') + ' keeps its color.',
357
357
  '',
358
358
  'And ' + typography.wrap({size: '13.5pt', color: '#175dc4', family: 'serif'}, '**precise words**') + ' keep their emphasis.',
359
359
  '',
@@ -499,11 +499,11 @@ Its historical line counts are not a current-engine or font-shaping acceptance g
499
499
  `--impl path/to/module.mjs` runs another implementation against the same documents; `--tolerance 2` sets the pixel
500
500
  tolerance.
501
501
 
502
- ## Licence
502
+ ## License
503
503
 
504
- MIT, the full text in `LICENSE`; Rapier-owned modules and the stylesheet keep their MIT line. Pretext's complete licence,
504
+ MIT, the full text in `LICENSE`; Rapier-owned modules and the stylesheet keep their MIT line. Pretext's complete license,
505
505
  notice and pinned source inventory are in `dist/agent/vendor/pretext/`. The selected upstream is unreleased main
506
- `bac1774c0f8b7a92e44b9da43b6d5443d55d0d9b`, despite its package version `0.0.9`. Its upstream licence includes
506
+ `bac1774c0f8b7a92e44b9da43b6d5443d55d0d9b`, despite its package version `0.0.9`. Its upstream license includes
507
507
  Chromium/WebKit BSD, Unicode and ICU notices for derived code and generated data; those notices travel with the kit
508
508
  and the exported wrapping runtime. The history projection uses the MIT diff core;
509
509
  its full grant is in `dist/packages/rapier-diff/LICENSE`. The Rapier editor is AGPL-3.0-only and
@@ -325,7 +325,7 @@ function initMarkdownIt() {
325
325
  const provider = env.rapierProviders === false ? null : _rapierProviders.mermaid;
326
326
  const native = globalThis.RapierFlowchart?.parseFlowchart(src).ok === true;
327
327
  const ready = native || !!(provider && provider.status === 'ready' && typeof provider.renderToString === 'function');
328
- if (!ready && env.rapierProviders !== false && !_diagramPromptedOnce) {
328
+ if (!ready && !provider?.request?.() && env.rapierProviders !== false && !_diagramPromptedOnce) {
329
329
  _diagramPromptedOnce = true;
330
330
  try { _rapierUiDiagram.request(); } catch (_) {}
331
331
  }
@@ -366,7 +366,7 @@ function initMarkdownIt() {
366
366
  if (env.rapierPage) return '<span data-rapier-math-source="">' + literal + '</span>';
367
367
  const mathProvider = env.rapierProviders === false ? null : _rapierProviders.math;
368
368
  if (!mathProvider || mathProvider.status !== 'ready' || typeof mathProvider.renderToString !== 'function') {
369
- if (env.rapierProviders !== false && !_mathPromptedOnce) {
369
+ if (!mathProvider?.request?.() && env.rapierProviders !== false && !_mathPromptedOnce) {
370
370
  _mathPromptedOnce = true;
371
371
  try { _rapierUiMath.request(); } catch (_) {}
372
372
  }
@@ -8,7 +8,7 @@ export function finish(iterator) {
8
8
 
9
9
  export function check(work) {
10
10
  work?.check?.();
11
- if (work?.signal?.aborted) throw Object.assign(new Error('The operation was cancelled.'), {name: 'AbortError', code: 'cancelled'});
11
+ if (work?.signal?.aborted) throw Object.assign(new Error('The operation was canceled.'), {name: 'AbortError', code: 'cancelled'});
12
12
  }
13
13
 
14
14
  export async function pause(work, fraction, label) {
@@ -340,7 +340,7 @@ function _rapierDocxRenderStyles(root) {
340
340
  const surface = into.createElement('div'); surface.className = 'md-render'; into.body.appendChild(surface);
341
341
  const canvas = into.createElement('canvas'); canvas.width = canvas.height = 1;
342
342
  const paint = canvas.getContext('2d'), colours = new Map();
343
- if (!paint) throw new Error('Word text colours could not be read.');
343
+ if (!paint) throw new Error('Word text colors could not be read.');
344
344
  const hex = colour => {
345
345
  if (!colours.has(colour)) {
346
346
  // CSS may resolve an accent to oklch/color-mix. The browser supplies its
@@ -39,7 +39,7 @@ export function separate(c, endA = c.before.length, endB = c.after.length) {
39
39
  for (const span of p.slice(0, 2)) { span[0] += shift; span[1] += shift; }
40
40
  }
41
41
  // Adjacent blocks deleted or inserted together: when the first carries the line break before it, each carries
42
- // its own, so any one restores apart from its neighbours.
42
+ // its own, so any one restores apart from its neighbors.
43
43
  if (!raw) for (let i = 1; i < c.result.length; i++) {
44
44
  const p = c.result[i - 1], q = c.result[i], kind = p[3][0], side = kind ? 1 : 0, text = side ? after : before;
45
45
  if (kind % 2 || q[3][0] !== kind || p[2] || q[2] || p[side][1] !== q[side][0] || p[1 - side][0] !== q[1 - side][0]) continue;
@@ -109,7 +109,7 @@ export function walker(c) {
109
109
  }
110
110
 
111
111
  // Unequal lines pair in order by shared words. A line sharing under a quarter of its words with every candidate is
112
- // replaced whole: an inserted line never borrows a neighbour's words, and a rewrite never reads as stray fragments.
112
+ // replaced whole: an inserted line never borrows a neighbor's words, and a rewrite never reads as stray fragments.
113
113
  function lines(x, y, context) {
114
114
  const n = x.length - 1, m = y.length - 1;
115
115
  if (n * m > 4096 || !spend(n * m + x[n] - x[0] + y[m] - y[0])) return row(x[0], x[n], y[0], y[m], context);
@@ -10,10 +10,10 @@ const inkReader = () => {
10
10
  const COLOR_NAME_ALT = Object.keys(TEXT_COLOR_NAMES).join('|');
11
11
  const COLOR_VALUE = '(?:#[0-9a-f]{6}|' + COLOR_NAME_ALT + ')';
12
12
 
13
- // Ink (docs/markdown-standard.md, "Ink"): a pen stroke that stays with the words it marks, a paired comment with the colour span's shape. The
13
+ // Ink (docs/markdown-standard.md, "Ink"): a pen stroke that stays with the words it marks, a paired comment with the color span's shape. The
14
14
  // opener holds the stroke:
15
15
  // <!--ink KIND [NUMBER] [COLOUR] [w=N] [box=W,H] [at=X,Y] [PATH]-->words<!--/ink-->
16
- // KIND is the stroke's kind, decided once when it was lifted; COLOUR is exactly the colour span's value, red when absent; box is the frame's
16
+ // KIND is the stroke's kind, decided once when it was lifted; COLOUR is exactly the color span's value, red when absent; box is the frame's
17
17
  // size when the stroke was drawn and at the frame's offset from the words' box, both in hundredths of an em; w is the pen's width as Draw
18
18
  // counts a nib (2 to 24; 9 is the default and is never written): the stroke is drawn 0.11 em wide at 9 and in proportion to w otherwise; PATH
19
19
  // is the stroke, its first point absolute in the frame and the rest as moves, hundredths of an em. One spelling: the fields in this order,
@@ -338,7 +338,7 @@ export function formatInkOpen(mark) {
338
338
  let colour = '';
339
339
  if (mark.hex != null) {
340
340
  const value = TEXT_COLOR_HEX_TO_NAME[mark.hex] || mark.hex;
341
- if (!new RegExp('^' + COLOR_VALUE + '$').test(value)) throw new TypeError('ink: the colour is the colour span\'s value');
341
+ if (!new RegExp('^' + COLOR_VALUE + '$').test(value)) throw new TypeError('ink: the color is the color span\'s value');
342
342
  colour = ' ' + value;
343
343
  }
344
344
  if (mark.width != null && (!Number.isInteger(mark.width) || mark.width < 2 || mark.width > 24)) throw new TypeError('ink: the width is an integer from 2 to 24, and 9 is spelled by leaving it out');
@@ -442,7 +442,7 @@ export function pairInkSpans(source, markers = null) {
442
442
  return pairSpanMarkers(source, 'ink', markers);
443
443
  }
444
444
 
445
- // Colour keeps its first opener; ink pairs each closer with the innermost opener. The shared range
445
+ // Color keeps its first opener; ink pairs each closer with the innermost opener. The shared range
446
446
  // shape lets custody owners keep every independent stroke, including strokes on identical words.
447
447
  export function pairMarkers(source, kind, markers = null) {
448
448
  const paired = pairSpanMarkers(source, kind, markers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapier-markdown-kit",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Read, render and write Self-contained Markdown: one .md file that carries its pictures, drawings and layout, and that any Markdown app can read. HTML renderer, stylesheet, text layout, Will/1 agent permissions, and an edit history with authorship and offline merge. MIT, no dependencies.",
5
5
  "keywords": [
6
6
  "markdown",
package/style.css CHANGED
@@ -267,9 +267,9 @@
267
267
  .md-render h2{font-size:calc(var(--md-text-body) * 1.9);line-height:calc(var(--md-line) * 1.5);font-weight:var(--md-fw-semibold)}
268
268
  .md-render h3{font-size:calc(var(--md-text-body) * 1.5);line-height:calc(var(--md-line) * 1.5);font-weight:var(--md-fw-semibold)}
269
269
  .md-render h4{font-size:calc(var(--md-text-body) * 1.25);font-weight:var(--md-fw-semibold)}
270
- /* h5/h6 complete the six-level hierarchy: modest but owned (explicit size/weight/colour), never
270
+ /* h5/h6 complete the six-level hierarchy: modest but owned (explicit size/weight/color), never
271
271
  the browser default. Size stays strictly monotonic below h4; h6 sits at the body's own size and
272
- firms up weight and dims colour, since its size alone would read as body text. */
272
+ firms up weight and dims color, since its size alone would read as body text. */
273
273
  .md-render h5{font-size:calc(var(--md-text-body) * 1.1);font-weight:var(--md-fw-semibold)}
274
274
  .md-render h6{font-size:var(--md-text-body);font-weight:var(--md-fw-semibold);color:var(--md-heading-muted-color)}
275
275
  .md-render p{margin:0 0 var(--md-gap-paragraph)}
@@ -300,9 +300,9 @@
300
300
 
301
301
  .md-render .task-list-item input[type="checkbox"] {
302
302
  --md-task-box: clamp(14px, .92em, 24px);
303
- /* A form control does not inherit colour on its own; the shell's own app sheet gives it one
303
+ /* A form control does not inherit color on its own; the shell's own app sheet gives it one
304
304
  (`input,textarea,select{...color:inherit}`) and an exported page does not carry that sheet, so
305
- it says so here. The drawn box names its own colours, so this changes no pixel today -- it
305
+ it says so here. The drawn box names its own colors, so this changes no pixel today -- it
306
306
  stops the two surfaces disagreeing about a property, which is how the next rule that does
307
307
  depend on it would go wrong quietly. */
308
308
  color: inherit;
@@ -321,10 +321,10 @@
321
321
  touch-action: manipulation;
322
322
  }
323
323
  /* The box and its tick are Feather's square and check-square, with squared corners: drawn on Feather's
324
- 24-unit grid with its 2-unit stroke, the box's corners mitred square, and a ticked box opens at its
324
+ 24-unit grid with its 2-unit stroke, the box's corners mitered square, and a ticked box opens at its
325
325
  top right where the tick breaks out through it. The grid is a third wider than the box itself (the
326
326
  box is units 3 to 21), so the painted square keeps exactly the place and size --rapier-task-box gave
327
- it; the ink is --color-line through a mask, so the theme recolours it and an export needs nothing
327
+ it; the ink is --color-line through a mask, so the theme recolors it and an export needs nothing
328
328
  more than the data: images its policy already admits. The three glyphs are written here once, and a
329
329
  Notes card's check rows read these same three (rapier-notes.css: one SVG per icon across Rapier). */
330
330
  :root,.md-render {
@@ -367,7 +367,7 @@
367
367
  .md-render ol>li::before{
368
368
  content:counter(rapier-ol);
369
369
  position:absolute;
370
- /* The circle is centred on the item's first line: the li's own padding, plus half of what the 2rem circle is taller than one line. */
370
+ /* The circle is centered on the item's first line: the li's own padding, plus half of what the 2rem circle is taller than one line. */
371
371
  inset-inline-start:calc(-2.75 * var(--md-unit) + var(--md-marker, 0px)); top:calc(calc(0.15 * var(--md-unit)) + (var(--md-line) - calc(2 * var(--md-unit))) / 2);
372
372
  width:calc(2 * var(--md-unit)); height:calc(2 * var(--md-unit));
373
373
  display:flex; align-items:center; justify-content:center;
@@ -581,7 +581,7 @@
581
581
  }
582
582
 
583
583
  /* Page break: unobtrusive by design, the same weight as .section-fold-btn (rapier-editor.css) --
584
- muted colour and .37 opacity, never the stronger --color-line the horizontal-rule variants use.
584
+ muted color and .37 opacity, never the stronger --color-line the horizontal-rule variants use.
585
585
  Invisible on paper: this sheet's print rule zeros this out and applies the actual break instead. */
586
586
  .md-render [data-md-break]{
587
587
  position:relative;
@@ -642,7 +642,7 @@
642
642
  font-size: var(--md-text-sm);
643
643
  color: var(--md-color-text-secondary);
644
644
  }
645
- /* A view preference can keep embedded SVGs on their original light-paper colours. */
645
+ /* A view preference can keep embedded SVGs on their original light-paper colors. */
646
646
  html[data-invert-image-alpha="off"] :is(img,.md-render svg.rapier-native-flowchart){color-scheme:light}
647
647
  .md-render img{
648
648
  max-width:100%;height:auto;
@@ -675,9 +675,9 @@ html:not([data-layout="plain"]) .md-render img[data-rapier-image-geometry="auto"
675
675
  .md-render mark[data-rapier-highlight="blue"]{--md-highlight-color:#4f91f7}
676
676
  .md-render mark[data-rapier-highlight="yellow"]{--md-highlight-color:#e6b91e}
677
677
  .md-render mark[data-rapier-highlight="purple"]{--md-highlight-color:#9b6dea}
678
- /* Text colour: the canonical (light) hex and its OKLCH-derived dark pair both ship as inline
678
+ /* Text color: the canonical (light) hex and its OKLCH-derived dark pair both ship as inline
679
679
  custom properties on the run itself (editor/engine.js, §b) — this just picks between them the
680
- same way as the document palette: the document colour scheme chooses the matching value. The five named swatches also carry a literal,
680
+ same way as the document palette: the document color scheme chooses the matching value. The five named swatches also carry a literal,
681
681
  pre-computed --md-color-dark here, so the common case survives even a round-trip that kept
682
682
  data-md-color but dropped style, exactly like highlight's own swatch constants. */
683
683
  .md-render [data-md-color]{--md-color-dark:var(--md-color);color:light-dark(var(--md-color),var(--md-color-dark))}