@markup-carve/carve-wasm 0.1.6 → 0.1.8

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
@@ -47,8 +47,9 @@ The package imports HTML, Markdown, Djot, and BBCode. `fromHtml`,
47
47
  with a fidelity report. The simpler `fromDjot` and `fromBbcode` helpers return
48
48
  only the converted string.
49
49
 
50
- Markdown, Djot, and BBCode reports currently mark fidelity as unverified. An
51
- empty diagnostic list does not claim that every construct was preserved.
50
+ Markdown reports assess supported constructs and report known losses. Inputs
51
+ outside that assessment receive `fidelity-unverified`. Djot and BBCode use the
52
+ conservative fallback except for verified literal text.
52
53
 
53
54
  ```js
54
55
  import { fromHtml, fromMarkdown, htmlToAst, htmlToCarve } from '@markup-carve/carve-wasm'
package/carve_wasm.d.ts CHANGED
@@ -67,7 +67,7 @@ export interface RenderOptions {
67
67
  positions?: boolean;
68
68
  lowercaseHeadingIds?: boolean;
69
69
  asciiHeadingIds?: "off" | "fold" | "strict";
70
- smartTypography?: "glyph" | "source";
70
+ smartTypography?: "glyph" | "source" | boolean | { quotes?: boolean };
71
71
  mode?: "interactive" | "static";
72
72
  profile?: "full" | "article" | "comment" | "minimal";
73
73
  profileBaseHost?: string;
package/carve_wasm_bg.js CHANGED
@@ -784,17 +784,23 @@ export function lintCarveWithOptions(source, options) {
784
784
  * @returns {string}
785
785
  */
786
786
  export function markdownToAstJson(source) {
787
- let deferred2_0;
788
- let deferred2_1;
787
+ let deferred3_0;
788
+ let deferred3_1;
789
789
  try {
790
790
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
791
791
  const len0 = WASM_VECTOR_LEN;
792
792
  const ret = wasm.markdownToAstJson(ptr0, len0);
793
- deferred2_0 = ret[0];
794
- deferred2_1 = ret[1];
795
- return getStringFromWasm0(ret[0], ret[1]);
793
+ var ptr2 = ret[0];
794
+ var len2 = ret[1];
795
+ if (ret[3]) {
796
+ ptr2 = 0; len2 = 0;
797
+ throw takeFromExternrefTable0(ret[2]);
798
+ }
799
+ deferred3_0 = ptr2;
800
+ deferred3_1 = len2;
801
+ return getStringFromWasm0(ptr2, len2);
796
802
  } finally {
797
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
803
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
798
804
  }
799
805
  }
800
806
 
@@ -1422,8 +1428,9 @@ export function toHtmlFull(source, symbols) {
1422
1428
  * * `labels` - override the engine-written strings (admonition names, the
1423
1429
  * endnotes heading, backlink text) for a page that is not in English. These
1424
1430
  * are TEXT and are escaped where they land, unlike `symbols`.
1425
- * * `smartTypography` - `"glyph"` (default) resolves `...` to an ellipsis,
1426
- * `"source"` keeps the author's run.
1431
+ * * `smartTypography` - `"glyph"` or `true` (default) resolves `...` to an
1432
+ * ellipsis, `"source"` or `false` keeps the author's run, and
1433
+ * `{ quotes: false }` keeps only the author's quotes.
1427
1434
  * * `lowercaseHeadingIds` (default `false`) and `asciiHeadingIds`
1428
1435
  * (`"off"` (default), `"fold"`, `"strict"`) - the slug policy, for a host
1429
1436
  * whose anchors have to match another generator's.
@@ -1997,6 +2004,10 @@ export function __wbg_iterator_de403ef31815a3e6() {
1997
2004
  const ret = Symbol.iterator;
1998
2005
  return ret;
1999
2006
  }
2007
+ export function __wbg_keys_e611eeb7873788db(arg0) {
2008
+ const ret = Object.keys(arg0);
2009
+ return ret;
2010
+ }
2000
2011
  export function __wbg_length_0c32cb8543c8e4c8(arg0) {
2001
2012
  const ret = arg0.length;
2002
2013
  return ret;
Binary file
@@ -76,7 +76,8 @@ HTML import projects through a DOM and cannot retain all Carve source
76
76
  constructs. Its `roundtrip` mode is for trusted Carve-produced HTML. The corpus
77
77
  ledger records output differences, while the stability gate requires a second
78
78
  import to settle. Inspect conversion reports before accepting imported source.
79
- Markdown, Djot and BBCode migration reports still mark fidelity as unverified.
79
+ Markdown reports assess supported constructs and report known losses. Incomplete
80
+ assessments, including nonliteral Djot and BBCode inputs, remain unverified.
80
81
 
81
82
  ProseMirror reports dropped nodes, degraded nodes and canonical source changes.
82
83
  A nonempty report requires a host decision before replacing the original
package/docs/reference.md CHANGED
@@ -33,10 +33,10 @@ astJsonToHtml(value)
33
33
 
34
34
  Portable migration code can use `fromHtml(html, mode)` and
35
35
  `fromMarkdown(markdown)`. Both return `{ value, report }`. Version 2 reports use
36
- the shared fidelity vocabulary. Markdown, Djot, and BBCode conservatively emit
37
- `fidelity-unverified` as `dropped` / `fallback` until their importers expose
38
- construct-level outcomes; an empty diagnostic list is therefore never used to
39
- imply fidelity that was not assessed.
36
+ the shared fidelity vocabulary. Markdown reports assess supported constructs
37
+ and report known losses; incomplete assessments use `fidelity-unverified` with
38
+ `dropped` / `fallback`. Djot and BBCode use that conservative fallback except
39
+ for verified literal text.
40
40
 
41
41
  ### Core renderer
42
42
 
@@ -170,7 +170,7 @@ defaults, so the three shorthands above use those defaults.
170
170
  | `sourceLine` | `false` | Stamp top-level blocks with `data-source-line` |
171
171
  | `positions` | `false` | Keep source offsets on the nodes |
172
172
  | `labels` | none | Override engine-written strings, for a page not in English |
173
- | `smartTypography` | `glyph` | `source` keeps the author's run instead of the glyph |
173
+ | `smartTypography` | `glyph` | `"source"` or `false` keeps the author's run instead of the glyph; `{ quotes: false }` keeps the author's quotes and still resolves dashes, ellipses and symbols. `"glyph"` and `true` are the default |
174
174
  | `lowercaseHeadingIds` | `false` | Lowercase the generated heading ids |
175
175
  | `asciiHeadingIds` | `off` | `fold` transliterates, `strict` guarantees ASCII |
176
176
  | `mentionUrl` | none | URL template for `@mention`; `{name}` / `{user}` take the encoded name |
@@ -672,8 +672,11 @@ const saved = fromProseMirror(JSON.stringify(editor.getJSON()))
672
672
  `Carve node type -> reason`: `dropped` where the content is gone (an
673
673
  abbreviation definition has no editor node), `degraded` where the text survives
674
674
  without its node type (a soft break becomes whitespace, smart typography
675
- resolves to the glyph). When node-level reports are empty, the binding also compares canonical source
676
- before and after the bridge. A difference is reported under `degraded.document`.
675
+ resolves to the glyph). The binding compares canonical source before and after
676
+ an immediate round trip, including when a node already reports a loss. A
677
+ change adds `degraded.document` with the reason `Canonical source changes on
678
+ the ProseMirror round trip`. A writer refusal instead reports `Canonical
679
+ source preservation could not be verified`.
677
680
  An empty pair of maps means that this immediate round trip preserves canonical
678
681
  source, not that subsequent edits in an editor preserve every Carve construct.
679
682
 
@@ -731,7 +734,7 @@ const html: string = toHtml('_Hello_')
731
734
  | `sanitizeSvg` | `(source: string, options?: object \| null) => SanitizeResult` | Sanitize an SVG document; strict unless an option says otherwise |
732
735
  | `parseLocator` | `(loc: string) => ParsedLocator` | Parse a citation locator into label, value and suffix |
733
736
  | `parseSourceLayoutJson` | `(source: string) => string` | The PART 12 §13 source-layout sidecar |
734
- | `markdownToAstJson` | `(source: string) => string` | Import Markdown straight to the tree, skipping the Carve-source round trip |
737
+ | `markdownToAstJson` | `(source: string) => string` | Import Markdown straight to the tree; throws `Error` when nesting exceeds the importer limit |
735
738
  | `htmlToAst` | `(html: string, mode?: string) => MigrationResult` | Import HTML straight to the tree; `{ value, report }` with the tree in `value` |
736
739
  | `expandIncludes` | `(source: string, options: object) => IncludeExpansion` | Expand `{{ path }}` through a SYNCHRONOUS `resolve`; returns the tree plus warnings, dependencies and resolver failures |
737
740
  | `parseSnapshot` | `(source: string) => string` | Parse and keep what a `reparse` needs; JSON `{ source, document, sourceLayout, changedSource, reusedPreviousTree, parsedSourceBytes }` |
package/node/README.md CHANGED
@@ -47,8 +47,9 @@ The package imports HTML, Markdown, Djot, and BBCode. `fromHtml`,
47
47
  with a fidelity report. The simpler `fromDjot` and `fromBbcode` helpers return
48
48
  only the converted string.
49
49
 
50
- Markdown, Djot, and BBCode reports currently mark fidelity as unverified. An
51
- empty diagnostic list does not claim that every construct was preserved.
50
+ Markdown reports assess supported constructs and report known losses. Inputs
51
+ outside that assessment receive `fidelity-unverified`. Djot and BBCode use the
52
+ conservative fallback except for verified literal text.
52
53
 
53
54
  ```js
54
55
  import { fromHtml, fromMarkdown, htmlToAst, htmlToCarve } from '@markup-carve/carve-wasm'
@@ -67,7 +67,7 @@ export interface RenderOptions {
67
67
  positions?: boolean;
68
68
  lowercaseHeadingIds?: boolean;
69
69
  asciiHeadingIds?: "off" | "fold" | "strict";
70
- smartTypography?: "glyph" | "source";
70
+ smartTypography?: "glyph" | "source" | boolean | { quotes?: boolean };
71
71
  mode?: "interactive" | "static";
72
72
  profile?: "full" | "article" | "comment" | "minimal";
73
73
  profileBaseHost?: string;
@@ -811,17 +811,23 @@ exports.lintCarveWithOptions = lintCarveWithOptions;
811
811
  * @returns {string}
812
812
  */
813
813
  function markdownToAstJson(source) {
814
- let deferred2_0;
815
- let deferred2_1;
814
+ let deferred3_0;
815
+ let deferred3_1;
816
816
  try {
817
817
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
818
818
  const len0 = WASM_VECTOR_LEN;
819
819
  const ret = wasm.markdownToAstJson(ptr0, len0);
820
- deferred2_0 = ret[0];
821
- deferred2_1 = ret[1];
822
- return getStringFromWasm0(ret[0], ret[1]);
820
+ var ptr2 = ret[0];
821
+ var len2 = ret[1];
822
+ if (ret[3]) {
823
+ ptr2 = 0; len2 = 0;
824
+ throw takeFromExternrefTable0(ret[2]);
825
+ }
826
+ deferred3_0 = ptr2;
827
+ deferred3_1 = len2;
828
+ return getStringFromWasm0(ptr2, len2);
823
829
  } finally {
824
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
830
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
825
831
  }
826
832
  }
827
833
  exports.markdownToAstJson = markdownToAstJson;
@@ -1472,8 +1478,9 @@ exports.toHtmlFull = toHtmlFull;
1472
1478
  * * `labels` - override the engine-written strings (admonition names, the
1473
1479
  * endnotes heading, backlink text) for a page that is not in English. These
1474
1480
  * are TEXT and are escaped where they land, unlike `symbols`.
1475
- * * `smartTypography` - `"glyph"` (default) resolves `...` to an ellipsis,
1476
- * `"source"` keeps the author's run.
1481
+ * * `smartTypography` - `"glyph"` or `true` (default) resolves `...` to an
1482
+ * ellipsis, `"source"` or `false` keeps the author's run, and
1483
+ * `{ quotes: false }` keeps only the author's quotes.
1477
1484
  * * `lowercaseHeadingIds` (default `false`) and `asciiHeadingIds`
1478
1485
  * (`"off"` (default), `"fold"`, `"strict"`) - the slug policy, for a host
1479
1486
  * whose anchors have to match another generator's.
@@ -2063,6 +2070,10 @@ function __wbg_get_imports() {
2063
2070
  const ret = Symbol.iterator;
2064
2071
  return ret;
2065
2072
  },
2073
+ __wbg_keys_e611eeb7873788db: function(arg0) {
2074
+ const ret = Object.keys(arg0);
2075
+ return ret;
2076
+ },
2066
2077
  __wbg_length_0c32cb8543c8e4c8: function(arg0) {
2067
2078
  const ret = arg0.length;
2068
2079
  return ret;
@@ -25,7 +25,7 @@ export const htmlToAst: (a: number, b: number, c: number, d: number) => [number,
25
25
  export const lintAccessibility: (a: number, b: number) => [number, number, number];
26
26
  export const lintCarve: (a: number, b: number) => [number, number, number];
27
27
  export const lintCarveWithOptions: (a: number, b: number, c: number) => [number, number, number];
28
- export const markdownToAstJson: (a: number, b: number) => [number, number];
28
+ export const markdownToAstJson: (a: number, b: number) => [number, number, number, number];
29
29
  export const mergeAst: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
30
30
  export const migrateBbcode: (a: number, b: number) => [number, number, number];
31
31
  export const migrateDjot: (a: number, b: number) => [number, number, number];
package/node/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markup-carve/carve-wasm",
3
3
  "description": "WASM bindings for the Carve parser and HTML renderer.",
4
- "version": "0.1.6",
4
+ "version": "0.1.8",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@markup-carve/carve-wasm",
3
3
  "type": "module",
4
4
  "description": "WASM bindings for the Carve parser and HTML renderer.",
5
- "version": "0.1.6",
5
+ "version": "0.1.8",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/render/README.md CHANGED
@@ -47,8 +47,9 @@ The package imports HTML, Markdown, Djot, and BBCode. `fromHtml`,
47
47
  with a fidelity report. The simpler `fromDjot` and `fromBbcode` helpers return
48
48
  only the converted string.
49
49
 
50
- Markdown, Djot, and BBCode reports currently mark fidelity as unverified. An
51
- empty diagnostic list does not claim that every construct was preserved.
50
+ Markdown reports assess supported constructs and report known losses. Inputs
51
+ outside that assessment receive `fidelity-unverified`. Djot and BBCode use the
52
+ conservative fallback except for verified literal text.
52
53
 
53
54
  ```js
54
55
  import { fromHtml, fromMarkdown, htmlToAst, htmlToCarve } from '@markup-carve/carve-wasm'
@@ -67,7 +67,7 @@ export interface RenderOptions {
67
67
  positions?: boolean;
68
68
  lowercaseHeadingIds?: boolean;
69
69
  asciiHeadingIds?: "off" | "fold" | "strict";
70
- smartTypography?: "glyph" | "source";
70
+ smartTypography?: "glyph" | "source" | boolean | { quotes?: boolean };
71
71
  mode?: "interactive" | "static";
72
72
  profile?: "full" | "article" | "comment" | "minimal";
73
73
  profileBaseHost?: string;
@@ -164,8 +164,9 @@ export function toHtmlFull(source, symbols) {
164
164
  * * `labels` - override the engine-written strings (admonition names, the
165
165
  * endnotes heading, backlink text) for a page that is not in English. These
166
166
  * are TEXT and are escaped where they land, unlike `symbols`.
167
- * * `smartTypography` - `"glyph"` (default) resolves `...` to an ellipsis,
168
- * `"source"` keeps the author's run.
167
+ * * `smartTypography` - `"glyph"` or `true` (default) resolves `...` to an
168
+ * ellipsis, `"source"` or `false` keeps the author's run, and
169
+ * `{ quotes: false }` keeps only the author's quotes.
169
170
  * * `lowercaseHeadingIds` (default `false`) and `asciiHeadingIds`
170
171
  * (`"off"` (default), `"fold"`, `"strict"`) - the slug policy, for a host
171
172
  * whose anchors have to match another generator's.
@@ -358,6 +359,11 @@ function __wbg_get_imports() {
358
359
  const ret = arg0 === null;
359
360
  return ret;
360
361
  },
362
+ __wbg___wbindgen_is_object_40c5a80572e8f9d3: function(arg0) {
363
+ const val = arg0;
364
+ const ret = typeof(val) === 'object' && val !== null;
365
+ return ret;
366
+ },
361
367
  __wbg___wbindgen_is_undefined_c0cca72b82b86f4d: function(arg0) {
362
368
  const ret = arg0 === undefined;
363
369
  return ret;
@@ -453,6 +459,10 @@ function __wbg_get_imports() {
453
459
  const ret = Array.isArray(arg0);
454
460
  return ret;
455
461
  },
462
+ __wbg_keys_e611eeb7873788db: function(arg0) {
463
+ const ret = Object.keys(arg0);
464
+ return ret;
465
+ },
456
466
  __wbg_length_6e821edde497a532: function(arg0) {
457
467
  const ret = arg0.length;
458
468
  return ret;
Binary file
@@ -2,7 +2,7 @@
2
2
  "name": "@markup-carve/carve-wasm",
3
3
  "type": "module",
4
4
  "description": "WASM bindings for the Carve parser and HTML renderer.",
5
- "version": "0.1.6",
5
+ "version": "0.1.8",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/web/README.md CHANGED
@@ -47,8 +47,9 @@ The package imports HTML, Markdown, Djot, and BBCode. `fromHtml`,
47
47
  with a fidelity report. The simpler `fromDjot` and `fromBbcode` helpers return
48
48
  only the converted string.
49
49
 
50
- Markdown, Djot, and BBCode reports currently mark fidelity as unverified. An
51
- empty diagnostic list does not claim that every construct was preserved.
50
+ Markdown reports assess supported constructs and report known losses. Inputs
51
+ outside that assessment receive `fidelity-unverified`. Djot and BBCode use the
52
+ conservative fallback except for verified literal text.
52
53
 
53
54
  ```js
54
55
  import { fromHtml, fromMarkdown, htmlToAst, htmlToCarve } from '@markup-carve/carve-wasm'
@@ -67,7 +67,7 @@ export interface RenderOptions {
67
67
  positions?: boolean;
68
68
  lowercaseHeadingIds?: boolean;
69
69
  asciiHeadingIds?: "off" | "fold" | "strict";
70
- smartTypography?: "glyph" | "source";
70
+ smartTypography?: "glyph" | "source" | boolean | { quotes?: boolean };
71
71
  mode?: "interactive" | "static";
72
72
  profile?: "full" | "article" | "comment" | "minimal";
73
73
  profileBaseHost?: string;
@@ -767,7 +767,7 @@ export interface InitOutput {
767
767
  readonly lintAccessibility: (a: number, b: number) => [number, number, number];
768
768
  readonly lintCarve: (a: number, b: number) => [number, number, number];
769
769
  readonly lintCarveWithOptions: (a: number, b: number, c: number) => [number, number, number];
770
- readonly markdownToAstJson: (a: number, b: number) => [number, number];
770
+ readonly markdownToAstJson: (a: number, b: number) => [number, number, number, number];
771
771
  readonly mergeAst: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
772
772
  readonly migrateBbcode: (a: number, b: number) => [number, number, number];
773
773
  readonly migrateDjot: (a: number, b: number) => [number, number, number];
package/web/carve_wasm.js CHANGED
@@ -786,17 +786,23 @@ export function lintCarveWithOptions(source, options) {
786
786
  * @returns {string}
787
787
  */
788
788
  export function markdownToAstJson(source) {
789
- let deferred2_0;
790
- let deferred2_1;
789
+ let deferred3_0;
790
+ let deferred3_1;
791
791
  try {
792
792
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
793
793
  const len0 = WASM_VECTOR_LEN;
794
794
  const ret = wasm.markdownToAstJson(ptr0, len0);
795
- deferred2_0 = ret[0];
796
- deferred2_1 = ret[1];
797
- return getStringFromWasm0(ret[0], ret[1]);
795
+ var ptr2 = ret[0];
796
+ var len2 = ret[1];
797
+ if (ret[3]) {
798
+ ptr2 = 0; len2 = 0;
799
+ throw takeFromExternrefTable0(ret[2]);
800
+ }
801
+ deferred3_0 = ptr2;
802
+ deferred3_1 = len2;
803
+ return getStringFromWasm0(ptr2, len2);
798
804
  } finally {
799
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
805
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
800
806
  }
801
807
  }
802
808
 
@@ -1424,8 +1430,9 @@ export function toHtmlFull(source, symbols) {
1424
1430
  * * `labels` - override the engine-written strings (admonition names, the
1425
1431
  * endnotes heading, backlink text) for a page that is not in English. These
1426
1432
  * are TEXT and are escaped where they land, unlike `symbols`.
1427
- * * `smartTypography` - `"glyph"` (default) resolves `...` to an ellipsis,
1428
- * `"source"` keeps the author's run.
1433
+ * * `smartTypography` - `"glyph"` or `true` (default) resolves `...` to an
1434
+ * ellipsis, `"source"` or `false` keeps the author's run, and
1435
+ * `{ quotes: false }` keeps only the author's quotes.
1429
1436
  * * `lowercaseHeadingIds` (default `false`) and `asciiHeadingIds`
1430
1437
  * (`"off"` (default), `"fold"`, `"strict"`) - the slug policy, for a host
1431
1438
  * whose anchors have to match another generator's.
@@ -2003,6 +2010,10 @@ function __wbg_get_imports() {
2003
2010
  const ret = Symbol.iterator;
2004
2011
  return ret;
2005
2012
  },
2013
+ __wbg_keys_e611eeb7873788db: function(arg0) {
2014
+ const ret = Object.keys(arg0);
2015
+ return ret;
2016
+ },
2006
2017
  __wbg_length_0c32cb8543c8e4c8: function(arg0) {
2007
2018
  const ret = arg0.length;
2008
2019
  return ret;
@@ -25,7 +25,7 @@ export const htmlToAst: (a: number, b: number, c: number, d: number) => [number,
25
25
  export const lintAccessibility: (a: number, b: number) => [number, number, number];
26
26
  export const lintCarve: (a: number, b: number) => [number, number, number];
27
27
  export const lintCarveWithOptions: (a: number, b: number, c: number) => [number, number, number];
28
- export const markdownToAstJson: (a: number, b: number) => [number, number];
28
+ export const markdownToAstJson: (a: number, b: number) => [number, number, number, number];
29
29
  export const mergeAst: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
30
30
  export const migrateBbcode: (a: number, b: number) => [number, number, number];
31
31
  export const migrateDjot: (a: number, b: number) => [number, number, number];
package/web/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@markup-carve/carve-wasm",
3
3
  "type": "module",
4
4
  "description": "WASM bindings for the Carve parser and HTML renderer.",
5
- "version": "0.1.6",
5
+ "version": "0.1.8",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",