@quillmark/wasm 0.123.0 → 0.124.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/CHANGELOG.md +142 -0
- package/README.md +15 -10
- package/core/wasm.d.ts +109 -27
- package/core/wasm.js +105 -30
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +2 -0
- package/package.json +1 -1
- package/render/wasm.d.ts +114 -30
- package/render/wasm.js +110 -33
- package/render/wasm_bg.wasm +0 -0
- package/render/wasm_bg.wasm.d.ts +2 -0
- package/runtime/runtime.d.ts +40 -18
- package/runtime/runtime.js +69 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.124.0 - 2026-10-10
|
|
4
|
+
|
|
5
|
+
Upgrade path: [0.123 → 0.124](docs/migrations/0.123-to-0.124.md).
|
|
6
|
+
|
|
7
|
+
### Elements
|
|
8
|
+
|
|
9
|
+
- feat(content,typst)!: **a `qm-<name>` element is stored content**, where its
|
|
10
|
+
tags dropped. A pair of tag lines wraps the blocks between them and keeps its
|
|
11
|
+
attributes as strings, and a line holding only `qm-*` tags is a tag line
|
|
12
|
+
wherever it stands outside a heading, a mark or a link. Export writes each
|
|
13
|
+
tag on its own line, and an element around nothing as its pair on one line.
|
|
14
|
+
An element left open, self-closing or inside a line of text drops and warns
|
|
15
|
+
`parse::dropped_construct` as `qm-<name>`. (#2096, #2141)
|
|
16
|
+
- feat(typst)!: **a Typst quill renders an element through the renderer its
|
|
17
|
+
plate registers in the helper's `elements` state**, called `(attrs, body)`,
|
|
18
|
+
and the built-in `keep` holds its run on one page. An element no renderer
|
|
19
|
+
takes, `keep` aside, warns `typst::unregistered_element` at its field, and
|
|
20
|
+
`quillmark validate` fails an `example.md` holding one. (#2096, #2140)
|
|
21
|
+
- feat(core,wasm)!: **the content types gain an element member**:
|
|
22
|
+
`Container::Element` and `Invariant::BadElement` in Rust, and `{ container:
|
|
23
|
+
"element" }` in WASM. (#2096)
|
|
24
|
+
|
|
25
|
+
### Tables
|
|
26
|
+
|
|
27
|
+
- feat(typst)!: **a `qm-table` wrapper lays out its table**: `widths` weights
|
|
28
|
+
the columns, `align` places the table, and a bare `headless` draws the first
|
|
29
|
+
row as a body row, with no `table.header`. (#2096, #2142)
|
|
30
|
+
- feat(content,typst)!: **a `qm-cell` pair around a table cell's whole content
|
|
31
|
+
aligns that cell** through `align` and `valign`, and a stored cell's `align`
|
|
32
|
+
or `valign` renders. (#2134, #2139)
|
|
33
|
+
- fix(content)!: **a `|` in a table cell's code span or link destination stays
|
|
34
|
+
in its cell**; export escapes it, where it split the cell on re-import.
|
|
35
|
+
(#2134)
|
|
36
|
+
|
|
37
|
+
### Task lists and footnotes
|
|
38
|
+
|
|
39
|
+
- feat(content,typst)!: **`- [ ]` and `- [x]` render a box**, ticked for
|
|
40
|
+
`[x]`, and import as the list item's `checked`, where the brackets were text.
|
|
41
|
+
A plate restyles the box through the helper's `tasks` state; `\[ ]` keeps the
|
|
42
|
+
text. (#2135)
|
|
43
|
+
- feat(content)!: **a footnote definition drops with its note and warns
|
|
44
|
+
`parse::dropped_construct` (`footnote`)**, where it silently defined a link.
|
|
45
|
+
(#2135)
|
|
46
|
+
|
|
47
|
+
### Raw HTML
|
|
48
|
+
|
|
49
|
+
- feat(content)!: **a markdown import reports what it drops**: a raw tag, the
|
|
50
|
+
block CommonMark runs it to, and a `<u>` left open each warn
|
|
51
|
+
`parse::dropped_construct`, at the body or at a `richtext` field, and
|
|
52
|
+
`quillmark validate` fails an `example.md` holding one. (#2096)
|
|
53
|
+
- fix(content)!: **an inline `<u>` pairs as HTML pairs it**, closing the
|
|
54
|
+
innermost open `<u>` and never a `**`. (#2096)
|
|
55
|
+
- fix(content)!: **a fenced block holding `<!-- a --> b` keeps its line, text
|
|
56
|
+
after a block nested in a tight list item opens its own line, and a line of
|
|
57
|
+
tags after a table's rows ends the table.** (#2096)
|
|
58
|
+
|
|
59
|
+
### Whitespace
|
|
60
|
+
|
|
61
|
+
- fix(typst): **typed spaces keep their width on the page**: a line's leading
|
|
62
|
+
spaces indent it, and a run of spaces inside a line, a mark's close between
|
|
63
|
+
them included, is as wide as the spaces in it. (#2143, #2144)
|
|
64
|
+
- fix(content)!: **a paragraph whose first line holds only tags that drop opens
|
|
65
|
+
without a leading space.** (#2141)
|
|
66
|
+
|
|
67
|
+
### Revise
|
|
68
|
+
|
|
69
|
+
- feat(core,wasm,python): **`reviseDocument` / `revise_document` replace a
|
|
70
|
+
whole document with markdown and keep its comment anchors, island ids and
|
|
71
|
+
`$ext` where they match**, and `toAnnotatedMarkdown` /
|
|
72
|
+
`to_markdown_annotated` show where each anchor sits. (#2096)
|
|
73
|
+
- fix(content)!: **every revise keeps the island ids it can match**, and mints
|
|
74
|
+
past the field's highest, where it re-minted each by position. (#2096, #2144)
|
|
75
|
+
- feat(core,wasm,python)!: **an import and a revise return their warnings**:
|
|
76
|
+
`from_markdown` returns `Imported`, a revise `Revised { delta, warnings }`,
|
|
77
|
+
and `addCard` / `add_card` a list of diagnostics. (#2096)
|
|
78
|
+
- fix(core): **a revise keeps the YAML comments nested in a field it
|
|
79
|
+
revises.** (#2144)
|
|
80
|
+
|
|
81
|
+
### Validation and rendering
|
|
82
|
+
|
|
83
|
+
- feat(core)!: **`Quill::validate` warns `validation::declined_construct` at a
|
|
84
|
+
field holding a construct the backend will not draw**, and the acroform
|
|
85
|
+
backend warns `backend::declined_construct` at render. (#2096)
|
|
86
|
+
- fix(wasm,python)!: **a one-shot render carries the render's warnings
|
|
87
|
+
alone**, not the document's parse and conform warnings. (#2096)
|
|
88
|
+
- fix(typst,cli)!: **`quillmark validate` reads `typst.plate_file` as a render
|
|
89
|
+
does**, refusing it with the render's own `typst::plate_*` diagnostic. (#2096)
|
|
90
|
+
|
|
91
|
+
### Storage
|
|
92
|
+
|
|
93
|
+
- feat(core)!: **a save writes `quillmark/document@0.124.0`**, the first tag
|
|
94
|
+
that holds an element or a task item's `checked`. Every older row loads as
|
|
95
|
+
before; a 0.123 build refuses a 0.124 row. (#2135)
|
|
96
|
+
|
|
97
|
+
### Card YAML
|
|
98
|
+
|
|
99
|
+
- fix(core)!: **text after a card-yaml block's root value, and a mapping
|
|
100
|
+
holding two keys of one text, fail the parse** at the offending line, where
|
|
101
|
+
they dropped or overwrote. A tag inside a merge's value warns at the value's
|
|
102
|
+
path. (#2096)
|
|
103
|
+
- fix(core): **the colon hint names the field whose `:` opens a mapping and
|
|
104
|
+
quotes its suggested value.** (#2136, #2144)
|
|
105
|
+
|
|
106
|
+
### WASM
|
|
107
|
+
|
|
108
|
+
- fix(wasm)!: **a JSON `null` inside a returned value crosses as `null`**, where
|
|
109
|
+
it crossed as `undefined`. (#2096)
|
|
110
|
+
- fix(wasm)!: **an options object inheriting a key its verb does not read from
|
|
111
|
+
a null-prototype object throws `unknown key`**, and one whose read throws is
|
|
112
|
+
refused with the handle left usable. (#2096)
|
|
113
|
+
|
|
114
|
+
### Base PDF reading
|
|
115
|
+
|
|
116
|
+
- fix(pdf)!: **a hybrid-xref base fails as `pdf::xref_stream`**, a `/Kids` that
|
|
117
|
+
is no array of references and an unreadable annotation fail to parse, and a
|
|
118
|
+
name compares through its `#xx` escapes. An `/Info` reached through a
|
|
119
|
+
reference chain stamps. (#2096)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## v0.123.1 - 2026-10-06
|
|
123
|
+
|
|
124
|
+
Upgrade path: [0.123.0 → 0.123.1](docs/migrations/0.123.0-to-0.123.1.md).
|
|
125
|
+
|
|
126
|
+
### Table cells
|
|
127
|
+
|
|
128
|
+
- feat(content)!: **a table cell carries a line break**, one `\n` in its
|
|
129
|
+
`text`, spelled `<br>` inside the pipe cell (`| line one<br>line two |`, any
|
|
130
|
+
case, with attributes or a closing `/`) and typeset as `#linebreak()`. A
|
|
131
|
+
mark spans the break as it spans a prose hard break, and its edge moves off
|
|
132
|
+
it. `to_markdown` writes a cell's `\n` as `<br>`, and a `\n` in a cell
|
|
133
|
+
written through the JSON lanes is a break, where normalization made it a
|
|
134
|
+
space. `TableCell.text` is unchanged in shape. (#2071)
|
|
135
|
+
- feat(content)!: **an inline `<br>` is a hard break in a paragraph and a
|
|
136
|
+
space in a heading**, where it rendered nothing, so a `richtext(inline)`
|
|
137
|
+
value holding one now has two lines and fails as `validation::not_inline`
|
|
138
|
+
(`edit::field_not_inline` on a strict write; a quill `default:` fails to
|
|
139
|
+
load), and nothing else reports the change. A `<br>` with no text before it
|
|
140
|
+
on its line, or alone on a line, still renders nothing; `\<br>` and a `<br>`
|
|
141
|
+
in backticks stay literal. A `<br>` in an image's alt is a space, where it
|
|
142
|
+
was dropped. (#2071)
|
|
143
|
+
|
|
144
|
+
|
|
3
145
|
## v0.123.0 - 2026-10-06
|
|
4
146
|
|
|
5
147
|
Upgrade path: [0.122 → 0.123](docs/migrations/0.122-to-0.123.md).
|
package/README.md
CHANGED
|
@@ -190,9 +190,9 @@ const doc = Document.storageVersionOf(content)
|
|
|
190
190
|
: Document.fromMarkdown(content);
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
The `schema` value (`quillmark/document@0.
|
|
193
|
+
The `schema` value (`quillmark/document@0.124.0`) is the **model version**,
|
|
194
194
|
not the running crate version. It is a hand-set constant, bumped only when
|
|
195
|
-
the `Document` model itself changes, so every `0.
|
|
195
|
+
the `Document` model itself changes, so every `0.124.x` patch release reads
|
|
196
196
|
and writes that same value.
|
|
197
197
|
|
|
198
198
|
- **Upgrading is safe.** A newer build reads documents an older build's
|
|
@@ -332,7 +332,7 @@ the per-call `_commit*` ABI):
|
|
|
332
332
|
const ed = quill.writer(doc); // Rust `quill.writer(doc)` twin; new DocumentWriter(quill, doc) also works
|
|
333
333
|
ed.set("subject", "Q3 results"); // strict-committed to the schema type
|
|
334
334
|
ed.setAll({ qty: "3", subject: "Q3" }); // all-or-nothing batch
|
|
335
|
-
ed.reviseField("subject", "Q3 **results**"); // typed AND anchor-preserving; returns
|
|
335
|
+
ed.reviseField("subject", "Q3 **results**"); // typed AND anchor-preserving; returns { delta, warnings }
|
|
336
336
|
ed.set("titel", "x"); // throws UnknownField: a typo, not a fallback
|
|
337
337
|
ed.card(2).set("body", "**note**"); // composable card, resolved by its $kind
|
|
338
338
|
```
|
|
@@ -393,11 +393,12 @@ A document that compiles to zero pages still produces a valid session
|
|
|
393
393
|
`pageCount === 0` to render a "no pages to preview" UI rather than relying on
|
|
394
394
|
the throw.
|
|
395
395
|
|
|
396
|
-
Their `warnings` differ in reach. `engine.render` returns
|
|
397
|
-
|
|
398
|
-
`
|
|
399
|
-
|
|
400
|
-
|
|
396
|
+
Their `warnings` differ in reach. `engine.render` returns every
|
|
397
|
+
`quill.validate(doc)` warning but `validation::declined_construct`, which the
|
|
398
|
+
compile raises as `backend::declined_construct`, then the compile's own;
|
|
399
|
+
`session.render` and `session.warnings` carry the compile's alone, so read
|
|
400
|
+
`quill.validate(doc)` beside them. Neither carries the load's: those stay on
|
|
401
|
+
`doc.warnings`, and a revise's on its receipt.
|
|
401
402
|
|
|
402
403
|
### Canvas Preview
|
|
403
404
|
|
|
@@ -505,8 +506,12 @@ same shape applies to every throw site:
|
|
|
505
506
|
- An object argument carrying a key its verb does not read: the render
|
|
506
507
|
options, `new Engine` options, an `Addr`, a `CardInput`. Every own string
|
|
507
508
|
key counts, a non-enumerable one and one holding `undefined` included. The
|
|
508
|
-
argument must be a plain object, its prototype `null
|
|
509
|
-
of any realm,
|
|
509
|
+
argument must be a plain object, its prototype `null`, `Object.prototype`
|
|
510
|
+
of any realm, or a null-prototype object whose keys count too, so a `Map`, a
|
|
511
|
+
class instance or `Object.create({ … })` throws. A payload item, the fields
|
|
512
|
+
object `storeFields` takes, and a `$ext` or `$seed` value read their own
|
|
513
|
+
enumerable keys alone: a non-enumerable or inherited key there is neither
|
|
514
|
+
read nor refused.
|
|
510
515
|
The diagnostic names the key or what was passed, and carries no `code`: it
|
|
511
516
|
is a call site to fix, not a condition to route on.
|
|
512
517
|
- `engine.render(quill, parsed)` against a quill whose *name* differs
|
package/core/wasm.d.ts
CHANGED
|
@@ -105,10 +105,17 @@ export type ContentLineKind =
|
|
|
105
105
|
export type ContentContainer =
|
|
106
106
|
| {
|
|
107
107
|
container: "list_item";
|
|
108
|
-
|
|
108
|
+
/** `checked` is present on a task item: `true` ticked, `false` open. */
|
|
109
|
+
attrs: { ordered: boolean; start: number; ordinal: number; checked?: boolean };
|
|
109
110
|
instance?: number;
|
|
110
111
|
}
|
|
111
|
-
| { container: "quote"; instance?: number }
|
|
112
|
+
| { container: "quote"; instance?: number }
|
|
113
|
+
| { container: "element"; attrs: ElementAttrs; instance?: number };
|
|
114
|
+
|
|
115
|
+
/** A carrier element's name and attributes, one bag: `$name` is the part of
|
|
116
|
+
* its `qm-<name>` tag after the prefix, and every other key an attribute as
|
|
117
|
+
* written. */
|
|
118
|
+
export type ElementAttrs = { $name: string; [attr: string]: string };
|
|
112
119
|
|
|
113
120
|
/** A mark over char range `[start, end)` into `Content.text`. `type` is a
|
|
114
121
|
* closed set, so `type === "link"` narrows `attrs` to `{ url: string }` with no
|
|
@@ -127,24 +134,37 @@ export type ContentMarkKind =
|
|
|
127
134
|
|
|
128
135
|
/** A cell in a `TableProps`. `marks` rides the prose `ContentMark` shape, but
|
|
129
136
|
* each mark's `start`/`end` are USV offsets into this cell's `text`, not into
|
|
130
|
-
* `Content.text`. */
|
|
137
|
+
* `Content.text`. A `\n` in `text` is a line break. */
|
|
131
138
|
export interface TableCell {
|
|
132
139
|
text: string;
|
|
133
140
|
marks: ContentMark[];
|
|
141
|
+
/** The cell's horizontal alignment; absent is its column's. */
|
|
142
|
+
align?: "left" | "center" | "right";
|
|
143
|
+
/** The cell's vertical alignment; absent is the quill's. */
|
|
144
|
+
valign?: "top" | "middle" | "bottom";
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
/** `props` of a `type: "table"` island: a pipe table normalized to one column
|
|
137
|
-
* count that `header`, every row of `rows`, and `
|
|
148
|
+
* count that `header`, every row of `rows`, `aligns` and `widths` all share.
|
|
149
|
+
* A layout key at its default is absent. */
|
|
138
150
|
export interface TableProps {
|
|
139
151
|
header: TableCell[];
|
|
140
152
|
rows: TableCell[][];
|
|
141
153
|
/** Per-column alignment, one entry per column. */
|
|
142
154
|
aligns: ("none" | "left" | "center" | "right")[];
|
|
155
|
+
/** Per-column relative weights; `null` is an auto-fit column. Absent when
|
|
156
|
+
* every column is auto-fit. A weight is an integer from 1 to
|
|
157
|
+
* `Number.MAX_SAFE_INTEGER`; any other entry drops the key. */
|
|
158
|
+
widths?: (number | null)[];
|
|
159
|
+
/** The table's placement; absent is the quill's. */
|
|
160
|
+
align?: "left" | "center" | "right";
|
|
161
|
+
/** `true` draws `header` as the first body row; absent is a header row. */
|
|
162
|
+
headless?: true;
|
|
143
163
|
}
|
|
144
164
|
|
|
145
165
|
/** `props` of a `type: "image"` island. Stores and round-trips; no backend
|
|
146
166
|
* typesets one, and a render that holds one warns `backend::declined_construct`,
|
|
147
|
-
* because
|
|
167
|
+
* because no backend resolves `url`. */
|
|
148
168
|
export interface ImageProps {
|
|
149
169
|
url: string;
|
|
150
170
|
alt: string;
|
|
@@ -205,6 +225,51 @@ export interface Delta {
|
|
|
205
225
|
ops: ({ retain: number } | { insert: string } | { delete: number })[];
|
|
206
226
|
}
|
|
207
227
|
|
|
228
|
+
/**
|
|
229
|
+
* The receipt of a markdown revise (`revise`, `writer.reviseBody`,
|
|
230
|
+
* `writer.reviseField`): the text `delta`, and one `parse::dropped_construct`
|
|
231
|
+
* warning per construct the import dropped, anchored at the revised address.
|
|
232
|
+
*/
|
|
233
|
+
export interface Revised {
|
|
234
|
+
delta: Delta;
|
|
235
|
+
warnings: Diagnostic[];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The receipt of `writer.reviseDocument`. `droppedAnchors` names every prose
|
|
240
|
+
* anchor the write did not carry, at its path in the stored document; a table
|
|
241
|
+
* cell's anchors drop unnamed. `warnings` are the parse's, then each revised
|
|
242
|
+
* content field's `parse::dropped_construct`, then the writer's `conform::*`.
|
|
243
|
+
* A field that lands rather than revises, on an inserted card or over no stored
|
|
244
|
+
* content, reports no drop.
|
|
245
|
+
*/
|
|
246
|
+
export interface DocumentRevised {
|
|
247
|
+
droppedAnchors: { path: string; id: string }[];
|
|
248
|
+
warnings: Diagnostic[];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The read `toAnnotatedMarkdown` returns: `toMarkdown`'s markdown with a
|
|
253
|
+
* read-only `<qm-anchor ref="…"></qm-anchor>` at each prose anchor's
|
|
254
|
+
* start its line can hold, and every prose anchor of every body and content
|
|
255
|
+
* field, spelled or not; a table cell's anchors are neither. Each names the
|
|
256
|
+
* `path` of its body or field and the text of the `line` its start sits on,
|
|
257
|
+
* island slots removed.
|
|
258
|
+
*/
|
|
259
|
+
export interface AnnotatedMarkdown {
|
|
260
|
+
markdown: string;
|
|
261
|
+
anchors: { id: string; path: string; line: string }[];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* A markdown import (`importMarkdown`): the canonical `content`, and one
|
|
266
|
+
* `parse::dropped_construct` warning per construct it dropped, with no `path`.
|
|
267
|
+
*/
|
|
268
|
+
export interface Imported {
|
|
269
|
+
content: Content;
|
|
270
|
+
warnings: Diagnostic[];
|
|
271
|
+
}
|
|
272
|
+
|
|
208
273
|
/** Which side of a same-position insertion `mapPos` lands a point on. */
|
|
209
274
|
export type Assoc = "before" | "after";
|
|
210
275
|
|
|
@@ -507,8 +572,8 @@ export interface Diagnostic {
|
|
|
507
572
|
message: string;
|
|
508
573
|
location?: Location;
|
|
509
574
|
/**
|
|
510
|
-
* Document-model path anchor (e.g. `"cards.indorsement[0].signature_block"`)
|
|
511
|
-
*
|
|
575
|
+
* Document-model path anchor (e.g. `"cards.indorsement[0].signature_block"`)
|
|
576
|
+
* where the diagnostic has a document address, `undefined` otherwise.
|
|
512
577
|
*/
|
|
513
578
|
path?: string;
|
|
514
579
|
hint?: string;
|
|
@@ -708,15 +773,17 @@ export class Document {
|
|
|
708
773
|
/**
|
|
709
774
|
* **Revise** the richtext value at `addr` from a markdown string: the
|
|
710
775
|
* default write path. Imports the markdown, diffs it against the current
|
|
711
|
-
* value, rebases surviving identity anchors, and returns the
|
|
712
|
-
* editor bridge maps its own positions through
|
|
713
|
-
* `
|
|
714
|
-
*
|
|
776
|
+
* value, rebases surviving identity anchors, and returns the `Revised`
|
|
777
|
+
* receipt: the text `delta` an editor bridge maps its own positions through
|
|
778
|
+
* (`mapPos`), and a `parse::dropped_construct` warning per construct the
|
|
779
|
+
* import dropped, its `path` the address written. An absent `addr.field`
|
|
780
|
+
* targets the body, an absent `addr.card` the main card; an absent field
|
|
781
|
+
* cold-imports from empty.
|
|
715
782
|
*
|
|
716
783
|
* Throws on an out-of-range card, a malformed field name, a present
|
|
717
784
|
* non-content field value, or an over-nested markdown input.
|
|
718
785
|
*/
|
|
719
|
-
revise(addr: Addr | string, markdown: string):
|
|
786
|
+
revise(addr: Addr | string, markdown: string): Revised;
|
|
720
787
|
/**
|
|
721
788
|
* The main card's `$seed[kind]` overlay object, or `undefined`. Feeds
|
|
722
789
|
* `quill.seedCard(kind, overlay)` without serializing the whole main card,
|
|
@@ -769,8 +836,18 @@ export class Document {
|
|
|
769
836
|
*/
|
|
770
837
|
storeSeedOverlay(card_kind: string, overlay: any): void;
|
|
771
838
|
/**
|
|
772
|
-
*
|
|
773
|
-
*
|
|
839
|
+
* `toMarkdown` with each prose anchor of every body and content field
|
|
840
|
+
* spelled read-only at its start where its line can hold the tag, and
|
|
841
|
+
* listed with its field's path and line either way. An import drops every
|
|
842
|
+
* tag, so `writer.reviseDocument` with the markdown keeps the anchors it keeps
|
|
843
|
+
* with `toMarkdown`'s.
|
|
844
|
+
*/
|
|
845
|
+
toAnnotatedMarkdown(): AnnotatedMarkdown;
|
|
846
|
+
/**
|
|
847
|
+
* Emit canonical Quillmark Markdown. Re-parsing the result produces a
|
|
848
|
+
* `Document` equal to `self` by value and by type, but for content: a body
|
|
849
|
+
* or content field holds what its markdown spells, so its anchors drop and
|
|
850
|
+
* its island ids re-mint. `toStored` keeps both.
|
|
774
851
|
*/
|
|
775
852
|
toMarkdown(): string;
|
|
776
853
|
/**
|
|
@@ -794,7 +871,7 @@ export class Document {
|
|
|
794
871
|
* The non-fatal diagnostics of the load that produced this document: parse
|
|
795
872
|
* warnings, plus `conform::*` warnings when it came through `quill.parse`.
|
|
796
873
|
* Session state, not document value: `equals` and the storage DTO exclude
|
|
797
|
-
* it, and `fromStored` / `loadStored` clear it.
|
|
874
|
+
* it, and `fromStored` / `loadStored` / `writer.reviseDocument` clear it.
|
|
798
875
|
*/
|
|
799
876
|
readonly warnings: Diagnostic[];
|
|
800
877
|
}
|
|
@@ -885,8 +962,8 @@ export class Quill {
|
|
|
885
962
|
*/
|
|
886
963
|
toTree(): Map<string, Uint8Array>;
|
|
887
964
|
/**
|
|
888
|
-
* Validate `doc` against this quill's schema, returning every diagnostic
|
|
889
|
-
*
|
|
965
|
+
* Validate `doc` against this quill's schema, returning every diagnostic:
|
|
966
|
+
* an error blocks a render, a warning does not. Forwards the canonical
|
|
890
967
|
* `validation::*` diagnostics the engine emits.
|
|
891
968
|
*/
|
|
892
969
|
validate(doc: Document): Diagnostic[];
|
|
@@ -936,18 +1013,20 @@ export function exportMarkdown(rt: Content): string;
|
|
|
936
1013
|
export function formatDiagnostic(diagnostic: Diagnostic): string;
|
|
937
1014
|
|
|
938
1015
|
/**
|
|
939
|
-
* Serialize structured
|
|
1016
|
+
* Serialize structured `DocPathSeg` segments back to the canonical path
|
|
940
1017
|
* string: the inverse of `parseDocPath`. Throws on a segment array the
|
|
941
1018
|
* deserializer rejects, and on an empty one.
|
|
942
1019
|
*/
|
|
943
1020
|
export function formatDocPath(segs: DocPathSeg[]): string;
|
|
944
1021
|
|
|
945
1022
|
/**
|
|
946
|
-
* Import a markdown string
|
|
947
|
-
*
|
|
948
|
-
*
|
|
1023
|
+
* Import a markdown string: the pure, document-free codec. Returns the
|
|
1024
|
+
* canonical `content` and a `parse::dropped_construct` warning per construct
|
|
1025
|
+
* the import dropped, with no `path`. `overwrite(addr, importMarkdown(md).content)`
|
|
1026
|
+
* spells the cold, anchor-losing write; prefer `revise` for edit semantics.
|
|
1027
|
+
* Throws on an over-nested input.
|
|
949
1028
|
*/
|
|
950
|
-
export function importMarkdown(markdown: string):
|
|
1029
|
+
export function importMarkdown(markdown: string): Imported;
|
|
951
1030
|
|
|
952
1031
|
/**
|
|
953
1032
|
* Whether `content` satisfies the `inline` constraint of `richtext` and
|
|
@@ -995,7 +1074,7 @@ export function mapPos(delta: Delta, pos: number, assoc: Assoc): number;
|
|
|
995
1074
|
|
|
996
1075
|
/**
|
|
997
1076
|
* Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
|
|
998
|
-
* `main.body`, `recipients[0].name`) into structured
|
|
1077
|
+
* `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
|
|
999
1078
|
* a consumer routes on segments instead of regexing the string. Throws on a
|
|
1000
1079
|
* malformed path.
|
|
1001
1080
|
*/
|
|
@@ -1003,11 +1082,12 @@ export function parseDocPath(path: string): DocPathSeg[];
|
|
|
1003
1082
|
|
|
1004
1083
|
/**
|
|
1005
1084
|
* Rebase `markdown` onto a `base` content: the document-free twin of `revise`,
|
|
1006
|
-
* returning the new `content
|
|
1007
|
-
* `Content.text`, surviving anchors rebased)
|
|
1008
|
-
*
|
|
1085
|
+
* returning the new `content`, the text `delta` (offsets are USV indices into
|
|
1086
|
+
* `Content.text`, surviving anchors rebased), and the import's
|
|
1087
|
+
* `parse::dropped_construct` warnings, with no `path`. Throws on an
|
|
1088
|
+
* over-nested markdown input or a non-content `base`.
|
|
1009
1089
|
*/
|
|
1010
|
-
export function rebase(base: Content, markdown: string): { content: Content; delta: Delta };
|
|
1090
|
+
export function rebase(base: Content, markdown: string): { content: Content; delta: Delta; warnings: Diagnostic[] };
|
|
1011
1091
|
|
|
1012
1092
|
/**
|
|
1013
1093
|
* Runs at instantiation, so a Rust panic reaches the console as a stack trace
|
|
@@ -1028,6 +1108,7 @@ export interface InitOutput {
|
|
|
1028
1108
|
readonly document__readerGet: (a: number, b: number, c: number, d: number) => void;
|
|
1029
1109
|
readonly document__readerGetContent: (a: number, b: number, c: number, d: number) => void;
|
|
1030
1110
|
readonly document__readerGetContentAt: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1111
|
+
readonly document__reviseDocument: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1031
1112
|
readonly document__reviseField: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1032
1113
|
readonly document_applyChange: (a: number, b: number, c: number, d: number) => void;
|
|
1033
1114
|
readonly document_bodyMarkdown: (a: number, b: number, c: number) => void;
|
|
@@ -1064,6 +1145,7 @@ export interface InitOutput {
|
|
|
1064
1145
|
readonly document_storeField: (a: number, b: number, c: number, d: number) => void;
|
|
1065
1146
|
readonly document_storeFields: (a: number, b: number, c: number, d: number) => void;
|
|
1066
1147
|
readonly document_storeSeedOverlay: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1148
|
+
readonly document_toAnnotatedMarkdown: (a: number, b: number) => void;
|
|
1067
1149
|
readonly document_toMarkdown: (a: number, b: number) => void;
|
|
1068
1150
|
readonly document_toStored: (a: number, b: number) => void;
|
|
1069
1151
|
readonly document_warnings: (a: number, b: number) => void;
|