tiptap-rusty-parser 0.2.0 → 0.2.1

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 CHANGED
@@ -53,6 +53,7 @@ boundary. `path` arguments are plain `number[]` index paths (root = `[]`).
53
53
  | Text | `textContent()`, `charCount()`, `wordCount()` |
54
54
  | Validate | `validate(schema)`, `isValid(schema)` |
55
55
  | Diff | `diff(other)` → `Change[]`; `applyChanges(changes)`; `invert(changes)` → reverse `Change[]` (undo) |
56
+ | Render | `toHTML()` → HTML string; `toHTMLWith(options)` (node/mark tag maps, unknown-policy, `selfClosing`, `spreadAttrs`, `textAlign`) |
56
57
 
57
58
  Methods throw on malformed input or a missing path target.
58
59
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tiptap-rusty-parser",
3
3
  "type": "module",
4
4
  "description": "Fast WASM parser/manipulator for Tiptap/ProseMirror JSONContent",
5
- "version": "0.2.0",
5
+ "version": "0.2.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -112,6 +112,14 @@ export class TiptapDoc {
112
112
  * Concatenated text of all descendant text nodes.
113
113
  */
114
114
  textContent(): string;
115
+ /**
116
+ * Render the document to an HTML string (Tiptap-default mapping).
117
+ */
118
+ toHTML(): string;
119
+ /**
120
+ * Render to HTML with an options object (see `HtmlOptions`).
121
+ */
122
+ toHTMLWith(options: any): string;
115
123
  /**
116
124
  * Serialize the document to a JS `JSONContent` object.
117
125
  */
@@ -352,6 +352,45 @@ export class TiptapDoc {
352
352
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
353
353
  }
354
354
  }
355
+ /**
356
+ * Render the document to an HTML string (Tiptap-default mapping).
357
+ * @returns {string}
358
+ */
359
+ toHTML() {
360
+ let deferred1_0;
361
+ let deferred1_1;
362
+ try {
363
+ const ret = wasm.tiptapdoc_toHTML(this.__wbg_ptr);
364
+ deferred1_0 = ret[0];
365
+ deferred1_1 = ret[1];
366
+ return getStringFromWasm0(ret[0], ret[1]);
367
+ } finally {
368
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
369
+ }
370
+ }
371
+ /**
372
+ * Render to HTML with an options object (see `HtmlOptions`).
373
+ * @param {any} options
374
+ * @returns {string}
375
+ */
376
+ toHTMLWith(options) {
377
+ let deferred2_0;
378
+ let deferred2_1;
379
+ try {
380
+ const ret = wasm.tiptapdoc_toHTMLWith(this.__wbg_ptr, options);
381
+ var ptr1 = ret[0];
382
+ var len1 = ret[1];
383
+ if (ret[3]) {
384
+ ptr1 = 0; len1 = 0;
385
+ throw takeFromExternrefTable0(ret[2]);
386
+ }
387
+ deferred2_0 = ptr1;
388
+ deferred2_1 = len1;
389
+ return getStringFromWasm0(ptr1, len1);
390
+ } finally {
391
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
392
+ }
393
+ }
355
394
  /**
356
395
  * Serialize the document to a JS `JSONContent` object.
357
396
  * @returns {any}
Binary file