@markup-carve/carve-wasm 0.1.4 → 0.1.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/carve_wasm.d.ts CHANGED
@@ -1,6 +1,87 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+
5
+ export function toHtmlWithOptions(source: string, options?: RenderOptions | null): string;
6
+ export function toHtmlWithRenderers(source: string, options?: StaticRenderOptions | null): StaticRenderResult;
7
+
8
+ export interface IncludeContext {
9
+ sourcePath: string | null;
10
+ stack: string[];
11
+ depth: number;
12
+ }
13
+ export type IncludeDenial = "outside-root" | "not-found" | "no-root" | "include-denied" | "include-unresolved";
14
+ export interface IncludeOptions {
15
+ resolve: (path: string, context: IncludeContext) => string | { source: string; id?: string } | { denial: IncludeDenial } | null;
16
+ sourcePath?: string;
17
+ extensions?: string[];
18
+ maxDepth?: number;
19
+ maxBytes?: number;
20
+ maxResolverCalls?: number;
21
+ maxWarnings?: number;
22
+ }
23
+ export interface IncludeExpansion {
24
+ json: string;
25
+ warnings: { rule: string; message: string; file: string | null }[];
26
+ suppressedWarnings: number;
27
+ dependencies: { id: string; resolved: boolean; denial: IncludeDenial | null }[];
28
+ chargedBytes: number;
29
+ resolverErrors: { path: string; message: string }[];
30
+ }
31
+ export interface SourcePosition {
32
+ startLine: number;
33
+ endLine: number;
34
+ startColumn: number;
35
+ endColumn: number;
36
+ /** Unicode codepoint offsets, not UTF-8 bytes or UTF-16 units. */
37
+ startOffset: number;
38
+ endOffset: number;
39
+ }
40
+ export interface RenderLoss {
41
+ code: string;
42
+ format: string;
43
+ target: string;
44
+ nodeType: string;
45
+ message: string;
46
+ pos?: SourcePosition;
47
+ }
48
+ export interface RenderResult {
49
+ value: string;
50
+ losses: RenderLoss[];
51
+ totalLosses: number;
52
+ /**
53
+ * How many losses each code accounts for, across the WHOLE render.
54
+ * `losses` is bounded, so counting codes off that array under-reports as
55
+ * soon as `truncated` is true; these totals do not.
56
+ */
57
+ totalsByCode: Record<string, number>;
58
+ truncated: boolean;
59
+ }
60
+ export interface RenderOptions {
61
+ full?: boolean;
62
+ extensions?: string[];
63
+ symbols?: Record<string, string> | Map<string, string>;
64
+ rawHtml?: boolean;
65
+ sections?: boolean;
66
+ sourceLine?: boolean;
67
+ positions?: boolean;
68
+ lowercaseHeadingIds?: boolean;
69
+ asciiHeadingIds?: "off" | "fold" | "strict";
70
+ smartTypography?: "glyph" | "source";
71
+ mode?: "interactive" | "static";
72
+ profile?: "full" | "article" | "comment" | "minimal";
73
+ profileBaseHost?: string;
74
+ mentionUrl?: string;
75
+ tagUrl?: string;
76
+ labels?: Record<string, string>;
77
+ }
78
+ export interface StaticRenderOptions extends RenderOptions {
79
+ renderers?: {
80
+ math?: (source: string, display: boolean) => string;
81
+ diagrams?: Record<string, (source: string) => string>;
82
+ };
83
+ }
84
+
4
85
  export interface LintWarning {
5
86
  /** 1-based line number. */
6
87
  line: number;
@@ -9,9 +90,14 @@ export interface LintWarning {
9
90
  /** Stable rule id, shared with carve-js and carve-php. */
10
91
  rule: string;
11
92
  message: string;
12
- /** 0-based BYTE offset into the source, inclusive. */
93
+ /**
94
+ * 0-based offset into the source in UTF-16 CODE UNITS, inclusive. That is
95
+ * what indexes a JavaScript string, so `source.slice(start, end)` selects the
96
+ * span the warning is about. It was a UTF-8 byte offset before 0.1.6, which
97
+ * agreed with this on an ASCII document and not outside one.
98
+ */
13
99
  start: number;
14
- /** 0-based BYTE offset into the source, exclusive. */
100
+ /** 0-based UTF-16 code unit offset into the source, exclusive. */
15
101
  end: number;
16
102
  }
17
103
 
@@ -77,10 +163,10 @@ export interface SourcePatch {
77
163
  }
78
164
 
79
165
  export interface StaticRendererError {
80
- /** The renderer that failed. Only "math" is bound. */
81
- renderer: "math";
82
- /** True for display math. */
83
- display: boolean;
166
+ /** "math", or the diagram fence class. */
167
+ renderer: string;
168
+ /** Present for math callbacks only. */
169
+ display?: boolean;
84
170
  /** The source the renderer was handed. */
85
171
  source: string;
86
172
  message: string;
@@ -96,9 +182,19 @@ export interface AccessibilityDiagnostic {
96
182
  rule: string;
97
183
  severity: "warning" | "error";
98
184
  message: string;
99
- /** 0-based BYTE offset into the source, or null when the node carried none. */
185
+ /**
186
+ * 0-based Unicode CODEPOINT offset, or null when the node carried none.
187
+ * Codepoints, not the UTF-8 bytes `LintWarning` counts: the two lint
188
+ * families answer in different units.
189
+ */
100
190
  startOffset: number | null;
101
191
  endOffset: number | null;
192
+ /**
193
+ * The same span in UTF-16 code units, which is what indexes a JavaScript
194
+ * string. Null exactly when `startOffset` / `endOffset` are.
195
+ */
196
+ startUtf16: number | null;
197
+ endUtf16: number | null;
102
198
  }
103
199
 
104
200
  export interface SanitizeSvgOptions {
@@ -131,6 +227,53 @@ export interface ProseMirrorResult {
131
227
 
132
228
 
133
229
 
230
+ export function astJsonToMarkdown(json: string, options?: RenderOptions | null): string;
231
+ export function astJsonToPlainText(json: string, options?: RenderOptions | null): string;
232
+ export function astJsonToAnsi(json: string, options?: RenderOptions | null): string;
233
+
234
+
235
+
236
+ export function lintCarveWithOptions(source: string, options?: RenderOptions | null): LintWarning[];
237
+
238
+
239
+
240
+ export function parseJsonWithOptions(source: string, options?: RenderOptions | null): string;
241
+ export function astJsonToHtml(json: string, options?: RenderOptions | null): string;
242
+
243
+
244
+
245
+ export function toHtmlWithReport(source: string, strict?: boolean | null, maximum?: number | null): RenderResult;
246
+ export function toMarkdownWithReport(source: string, strict?: boolean | null, maximum?: number | null): RenderResult;
247
+ export function toPlainTextWithReport(source: string, strict?: boolean | null, maximum?: number | null): RenderResult;
248
+ export function toAnsiWithReport(source: string, strict?: boolean | null, maximum?: number | null): RenderResult;
249
+ export function toCarveWithReport(source: string, strict?: boolean | null, maximum?: number | null): RenderResult;
250
+
251
+
252
+
253
+ export function toMarkdownWithOptions(source: string, options?: RenderOptions | null): string;
254
+ export function toPlainTextWithOptions(source: string, options?: RenderOptions | null): string;
255
+ export function toAnsiWithOptions(source: string, options?: RenderOptions | null): string;
256
+ export function toCarveWithOptions(source: string, options?: RenderOptions | null): string;
257
+
258
+
259
+
260
+ /**
261
+ * A parser snapshot retained between editor updates. Call `free()` when done.
262
+ */
263
+ export class ParserSession {
264
+ free(): void;
265
+ [Symbol.dispose](): void;
266
+ /**
267
+ * Apply byte edits; a rejected edit leaves the session unchanged.
268
+ */
269
+ edit(changes: string): string;
270
+ constructor(source: string);
271
+ /**
272
+ * The current result, with byte ranges and parser-work counters.
273
+ */
274
+ snapshot(): string;
275
+ }
276
+
134
277
  /**
135
278
  * Replay patch JSON onto a PART 12 tree, returning the result as AST JSON.
136
279
  */
@@ -169,13 +312,7 @@ export function applyReversibleAstPatch(ast: string, patch: string, inverse?: bo
169
312
  /**
170
313
  * Apply a trusted patch after its source length and fingerprint still match.
171
314
  */
172
- export function applySourcePatch(source: string, patch: any): string;
173
-
174
- /**
175
- * Render an AST-JSON document (PART 12) to ANSI-styled text. See
176
- * [`ast_json_to_markdown`], including what a tree without positions costs.
177
- */
178
- export function astJsonToAnsi(json: string, options?: object | null): string;
315
+ export function applySourcePatch(source: string, patch: SourcePatch): string;
179
316
 
180
317
  /**
181
318
  * Render an AST-JSON document (PART 12) back to canonical Carve source.
@@ -186,46 +323,6 @@ export function astJsonToAnsi(json: string, options?: object | null): string;
186
323
  */
187
324
  export function astJsonToCarve(json: string): string;
188
325
 
189
- /**
190
- * Render an AST-JSON document (PART 12) to HTML.
191
- *
192
- * The other half of `parseJson`. A host that reads the tree in a browser does
193
- * it to CHANGE something, and until now there was no way to render the result:
194
- * the binding could serialize a tree out and not take one back.
195
- *
196
- * Takes the same options object as [`to_html_with_options`], so an edited tree
197
- * renders under the profile, labels and switches the host already configured.
198
- */
199
- export function astJsonToHtml(json: string, options?: object | null): string;
200
-
201
- /**
202
- * Render an AST-JSON document (PART 12) to Markdown.
203
- *
204
- * The direct call for a host that already holds a tree. Without it Markdown was
205
- * reached through `astJsonToCarve` and then `toMarkdown`: a canonical write, a
206
- * re-parse and a second render for one answer, and lossier than this, because a
207
- * tree holding something no Carve source can spell is refused by the write
208
- * rather than rendered.
209
- *
210
- * Takes the same options object as [`to_markdown_with_options`], and reads the
211
- * same narrow part of it. The profile filter and the `before_render` hooks run,
212
- * as they do in [`ast_json_to_html`].
213
- *
214
- * ORDERING FOLLOWS THE TREE. `toMarkdown` parses with positions on, because
215
- * section 7 orders collected definitions by source position. A tree arriving as
216
- * JSON carries whatever positions its producer put there, and one carrying none
217
- * prints its footnote and link definitions in label order. That is the only
218
- * order available to a tree without spans, so it is reported here rather than
219
- * repaired.
220
- */
221
- export function astJsonToMarkdown(json: string, options?: object | null): string;
222
-
223
- /**
224
- * Render an AST-JSON document (PART 12) to plain text. See
225
- * [`ast_json_to_markdown`], including what a tree without positions costs.
226
- */
227
- export function astJsonToPlainText(json: string, options?: object | null): string;
228
-
229
326
  /**
230
327
  * The difference between two PART 12 trees, as patch JSON.
231
328
  *
@@ -310,7 +407,7 @@ export function createSourcePatch(source: string, replacement: string, kind: str
310
407
  * and a span on a node that came from a child would point into a source the
311
408
  * caller did not pass.
312
409
  */
313
- export function expandIncludes(source: string, options: object): IncludeExpansion;
410
+ export function expandIncludes(source: string, options: IncludeOptions): IncludeExpansion;
314
411
 
315
412
  /**
316
413
  * Every extension name this build accepts, in registry order.
@@ -401,22 +498,15 @@ export function lintAccessibility(source: string): AccessibilityDiagnostic[];
401
498
  *
402
499
  * Returns an array of `{ line, column, rule, message, start, end }`. The rule
403
500
  * ids are shared with carve-js and carve-php, so the same trigger reports the
404
- * same id everywhere. Offsets are BYTE offsets into the source, matching the
405
- * engine.
501
+ * same id everywhere. Offsets count UTF-16 CODE UNITS, so they index the
502
+ * JavaScript string the caller holds; the engine answers in bytes and this
503
+ * wrapper converts (#164).
406
504
  *
407
505
  * Built as JS objects rather than a JSON string: a message carries arbitrary
408
506
  * document text, and hand-rolled JSON escaping is where that goes wrong.
409
507
  */
410
508
  export function lintCarve(source: string): LintWarning[];
411
509
 
412
- /**
413
- * Lint a document with the same options object the render entry points take.
414
- *
415
- * `lintCarve` is the option-less form. Which degradations exist depends on the
416
- * extensions in play, so a host that renders with a set has to lint with it.
417
- */
418
- export function lintCarveWithOptions(source: string, options?: object | null): LintWarning[];
419
-
420
510
  /**
421
511
  * Import Markdown straight to the tree, as AST JSON.
422
512
  *
@@ -490,16 +580,6 @@ export function needsReview(source: string, current_version: string): boolean;
490
580
  */
491
581
  export function parseJson(source: string): string;
492
582
 
493
- /**
494
- * Serialize the tree with the same options object as
495
- * [`to_html_with_options`], so a host can export the tree of an untrusted
496
- * document under the `profile` it renders that document with.
497
- *
498
- * `positions` is not read: every serialized tree this binding produces carries
499
- * them, as in [`parse_json`].
500
- */
501
- export function parseJsonWithOptions(source: string, options?: object | null): string;
502
-
503
583
  /**
504
584
  * Parse the locator portion of a citation into `{ label, value, suffixText }`.
505
585
  *
@@ -549,8 +629,8 @@ export function readStamp(source: string): Stamp | null;
549
629
  *
550
630
  * `changes` is a JSON array of `{ range: [start, end], replacement }`.
551
631
  *
552
- * THE OFFSETS ARE UTF-8 BYTE OFFSETS, which is what `parseJson` positions and
553
- * `createSourcePatch` ranges already mean. A browser editor counts UTF-16 code
632
+ * THE OFFSETS ARE UTF-8 BYTE OFFSETS, matching `createSourcePatch` ranges.
633
+ * `parseJson` positions count Unicode codepoints instead. A browser editor counts UTF-16 code
554
634
  * units, so a host holding a `selectionStart` converts before calling - an
555
635
  * offset that lands inside a multi-byte character is refused rather than
556
636
  * guessed at.
@@ -560,9 +640,9 @@ export function readStamp(source: string): Stamp | null;
560
640
  * result the caller asked for.
561
641
  *
562
642
  * `reusedPreviousTree` says whether the parse reused any of the previous one.
563
- * The pinned engine always reports `false` - it validates and applies the
564
- * edits and then parses the whole source - so a host should read this as the
565
- * engine's own answer rather than assume work was saved.
643
+ * The engine can reuse unchanged plain paragraphs. Other syntax falls back
644
+ * to a full parse. This function rebuilds the initial snapshot from source;
645
+ * use a parser session to retain it across edits.
566
646
  */
567
647
  export function reparse(source: string, changes: string): string;
568
648
 
@@ -593,14 +673,6 @@ export function stampCarve(formatted: string, generated_by: string, form?: strin
593
673
 
594
674
  export function toAnsi(source: string): string;
595
675
 
596
- /**
597
- * Render to ANSI text with an options object. See
598
- * [`to_markdown_with_options`].
599
- */
600
- export function toAnsiWithOptions(source: string, options?: object | null): string;
601
-
602
- export function toAnsiWithReport(source: string, strict?: boolean | null, maximum?: number | null): any;
603
-
604
676
  export function toCarve(source: string): string;
605
677
 
606
678
  /**
@@ -608,16 +680,6 @@ export function toCarve(source: string): string;
608
680
  */
609
681
  export function toCarvePatch(source: string): SourcePatch;
610
682
 
611
- /**
612
- * Write canonical Carve with an options object.
613
- *
614
- * `profile` is the only option this target reads; see
615
- * [`to_markdown_with_options`] for why.
616
- */
617
- export function toCarveWithOptions(source: string, options?: object | null): string;
618
-
619
- export function toCarveWithReport(source: string, strict?: boolean | null, maximum?: number | null): any;
620
-
621
683
  export function toHtml(source: string): string;
622
684
 
623
685
  /**
@@ -636,150 +698,6 @@ export function toHtml(source: string): string;
636
698
  */
637
699
  export function toHtmlFull(source: string, symbols?: object | null): string;
638
700
 
639
- /**
640
- * Render with an options object, the general form of the three shorthands
641
- * above.
642
- *
643
- * ```js
644
- * toHtmlWithOptions('# A\n\np\n', { sections: false })
645
- * // '<h1 id="A">A</h1>\n<p>p</p>'
646
- *
647
- * toHtmlWithOptions(src, { sections: false, symbols: { rocket: '🚀' }, full: true })
648
- *
649
- * toHtmlWithOptions(untrusted, { rawHtml: false })
650
- * ```
651
- *
652
- * Every field is optional:
653
- *
654
- * * `sections` (default `true`) - wrap each top-level heading, and the content
655
- * following it up to the next same-or-shallower heading, in a
656
- * `<section id="…">` (spec PART 9 §13). `false` renders headings flat with
657
- * the id back on the `<h*>` and the former section children as siblings.
658
- * For a host whose CSS or JS assumes rendered blocks are direct children of
659
- * the content container - the `.stack > * + *` spacing idiom,
660
- * `:first-child`, `nth-child()` counting, `element.children` walks - the
661
- * wrapper is the one output change a clean source migration still breaks.
662
- * * `symbols` - the same map as [`to_html_with_symbols`], with the same
663
- * TRUSTED-RAW contract: mapped values are emitted UNESCAPED, so never build
664
- * it from untrusted input.
665
- * * `extensions` - an array of extension names to enable, e.g.
666
- * `["glossary", "table-of-contents"]`. `extensions()` reports what this
667
- * build accepts. An unknown name throws: a silently ignored extension would
668
- * render as missing behavior that looks like a Carve bug. Takes precedence
669
- * over `full`.
670
- * * `full` (default `false`) - enable the preview extension set instead of
671
- * rendering core-only.
672
- * * `rawHtml` (default `true`) - render an explicit passthrough - the `=html`
673
- * raw block and the `` `…`{=html} `` inline raw span - as markup. `false`
674
- * emits it as escaped text instead, the same switch carve-js spells
675
- * `allowRawHtml`. A host that renders a document it did not author (a shared
676
- * link, a comment field, anything a reader supplies) wants `false`: without
677
- * it a passthrough is a way to run script on the host's origin.
678
- * * `profile` - one of `"full"`, `"article"`, `"comment"`, `"minimal"`. The
679
- * rest of the untrusted-input story: input length, denied constructs, link
680
- * policy. A document the profile REJECTS throws a `ProfileViolationError`
681
- * carrying `violations`, rather than resolving to an empty string.
682
- * * `profileBaseHost` - the host counted as internal when the profile's link
683
- * policy distinguishes internal from external links.
684
- * * `mode` - `"interactive"` (default) or `"static"`, the self-contained form
685
- * for print, PDF and archival: no client scripts.
686
- * * `sourceLine` (default `false`) - stamp top-level blocks with
687
- * `data-source-line`, for editor preview scroll-sync.
688
- * * `positions` (default `false`) - keep source offsets on the nodes.
689
- * * `labels` - override the engine-written strings (admonition names, the
690
- * endnotes heading, backlink text) for a page that is not in English. These
691
- * are TEXT and are escaped where they land, unlike `symbols`.
692
- * * `smartTypography` - `"glyph"` (default) resolves `...` to an ellipsis,
693
- * `"source"` keeps the author's run.
694
- * * `lowercaseHeadingIds` (default `false`) and `asciiHeadingIds`
695
- * (`"off"` (default), `"fold"`, `"strict"`) - the slug policy, for a host
696
- * whose anchors have to match another generator's.
697
- * * `mentionUrl` and `tagUrl` - URL templates for `@mention` and `#tag`.
698
- * Without them both render as inert spans, which is why a host that wants
699
- * them linked has to say where to. The token name is percent-encoded into
700
- * `{name}` - `{user}` works too for a mention - and the result goes through
701
- * the same URL sanitizer as an authored link. These are the HOST's
702
- * configuration, not the document's: the template is trusted, the name
703
- * substituted into it is not.
704
- *
705
- * An unrecognized key is ignored: the object is configuration, and a caller
706
- * who mistypes one deserves the render to still work. A wrong TYPE on a key
707
- * that is recognized does throw, because that changes behavior silently.
708
- *
709
- * `renderers` is the one recognized key this entry point refuses, because a
710
- * render callback can fail and a bare string has nowhere to report that. Use
711
- * [`to_html_with_renderers`].
712
- *
713
- * Turning sections off changes nothing else. Ids, collision dedup, `</#id>`
714
- * crossrefs, implicit `[Heading][]` references and heading numbering all
715
- * resolve against the slug rather than the element carrying it, and the
716
- * endnotes `<section role="doc-endnotes">` is a separate construct that is
717
- * still emitted.
718
- */
719
- export function toHtmlWithOptions(source: string, options?: object | null): string;
720
-
721
- /**
722
- * Render with a build-time math renderer, the option `mode: "static"` needs.
723
- *
724
- * Static output carries no client scripts, so a formula it contains has to be
725
- * rendered while the HTML is being written. `renderers.math` is the callback
726
- * the engine calls for each ``` ```math ``` fence, with the TeX source and a
727
- * display flag; KaTeX's `renderToString` has that exact shape.
728
- *
729
- * ```js
730
- * toHtmlWithRenderers(src, {
731
- * mode: 'static',
732
- * extensions: ['math-block'],
733
- * renderers: { math: (tex, display) => katex.renderToString(tex, { displayMode: display }) },
734
- * })
735
- * // { html: '…', rendererErrors: [] }
736
- * ```
737
- *
738
- * SECURITY: what the callback returns is inserted as **TRUSTED RAW HTML**, the
739
- * same trust class as a `symbols` value. The difference worth stating: a symbol
740
- * value is host configuration keyed by a NAME, while a renderer is host
741
- * configuration that is HANDED DOCUMENT CONTENT and typically echoes some of it
742
- * back. A host rendering documents it did not author is accepting whatever its
743
- * renderer makes of that input, so the escaping is the renderer's job.
744
- *
745
- * The engine consults the renderer only under `mode: "static"`; interactive
746
- * output keeps the `\[…\]` source for the client to typeset, and so does a
747
- * static render with no renderer supplied.
748
- *
749
- * The callback must be SYNCHRONOUS. wasm-bindgen cannot await across it, so an
750
- * `async` renderer returns a Promise the engine has no way to resolve; that is
751
- * recorded as a failure rather than stringified into the document.
752
- *
753
- * `renderers.diagrams` is the same callback one level down, keyed by the
754
- * fence's css class: `{ mermaid: (source) => html }`. A host that renders its
755
- * diagrams beforehand passes the lookup in that one line -
756
- * `(source) => prerendered.get(source)`. Mermaid itself cannot be passed,
757
- * because its `render` returns a Promise from v10 on.
758
- *
759
- * ```js
760
- * toHtmlWithRenderers(src, {
761
- * mode: 'static',
762
- * extensions: ['fenced-render'],
763
- * renderers: { diagrams: { mermaid: (source) => prerendered.get(source) } },
764
- * })
765
- * ```
766
- *
767
- * A diagram key the document never uses renders nothing and reports nothing.
768
- * So does a fence whose class the caller did not configure: the engine
769
- * degrades it to an escaped source block, and this binding never sees the
770
- * node.
771
- *
772
- * A callback that throws, or returns anything other than a string, does not
773
- * abort the render: the node it was called for emits nothing and the failure
774
- * is reported in `rendererErrors`, with `renderer` naming the css class.
775
- * This entry point exists because [`to_html_with_options`] returns a bare
776
- * string with nowhere to put that, and so it rejects `renderers` rather than
777
- * dropping the failures.
778
- */
779
- export function toHtmlWithRenderers(source: string, options?: object | null): StaticRenderResult;
780
-
781
- export function toHtmlWithReport(source: string, strict?: boolean | null, maximum?: number | null): any;
782
-
783
701
  /**
784
702
  * Render with the core profile and a **symbols map**: `{ rocket: "🚀" }` (a
785
703
  * plain object or a `Map`). A `:name:` symbol whose name is in the map renders
@@ -800,42 +718,8 @@ export function toHtmlWithSymbols(source: string, symbols?: object | null): stri
800
718
 
801
719
  export function toMarkdown(source: string): string;
802
720
 
803
- /**
804
- * Render to Markdown with the same options object as
805
- * [`to_html_with_options`].
806
- *
807
- * `profile` is why this exists. Without it a host can hold an untrusted
808
- * document to a profile on the way to HTML and not on the way to Markdown,
809
- * out of one package: the max-length bound, the denied constructs and the
810
- * link policy were all unreachable here. A document the profile rejects
811
- * throws a `ProfileViolationError` rather than resolving to an empty string.
812
- *
813
- * What these targets read is narrower than HTML's list: `profile` and
814
- * `smartTypography` change the output and extensions run, while `symbols`
815
- * (markup-carve/carve-rs#1668), `labels`, `sections`, `sourceLine`, `mode` and
816
- * the heading-id switches are HTML-side concerns the engine's other renderers
817
- * do not consult. `renderers` is refused for the reason
818
- * [`to_html_with_options`] refuses it.
819
- *
820
- * [`to_carve_with_options`] is narrower again and reads `profile` alone: the
821
- * engine's canonical writer is parse-only by contract, so extensions and
822
- * `smartTypography` are inert there. They are accepted rather than refused
823
- * because one options object is meant to serve every target.
824
- */
825
- export function toMarkdownWithOptions(source: string, options?: object | null): string;
826
-
827
- export function toMarkdownWithReport(source: string, strict?: boolean | null, maximum?: number | null): any;
828
-
829
721
  export function toPlainText(source: string): string;
830
722
 
831
- /**
832
- * Render to plain text with an options object. See
833
- * [`to_markdown_with_options`].
834
- */
835
- export function toPlainTextWithOptions(source: string, options?: object | null): string;
836
-
837
- export function toPlainTextWithReport(source: string, strict?: boolean | null, maximum?: number | null): any;
838
-
839
723
  /**
840
724
  * Convert Carve source to the ProseMirror document shape.
841
725
  *
package/carve_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./carve_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- applyAstPatch, applyProfile, applyReversibleAstPatch, applySourcePatch, astJsonToAnsi, astJsonToCarve, astJsonToHtml, astJsonToMarkdown, astJsonToPlainText, createAstPatch, createReversibleAstPatch, createSourcePatch, expandIncludes, extensions, fromBbcode, fromDjot, fromHtml, fromMarkdown, fromProseMirror, htmlToAst, htmlToCarve, lintAccessibility, lintCarve, lintCarveWithOptions, markdownToAstJson, mergeAst, migrateBbcode, migrateDjot, needsReview, parseJson, parseJsonWithOptions, parseLocator, parseSnapshot, parseSourceLayoutJson, readStamp, reparse, sanitizeSvg, stampCarve, toAnsi, toAnsiWithOptions, toAnsiWithReport, toCarve, toCarvePatch, toCarveWithOptions, toCarveWithReport, toHtml, toHtmlFull, toHtmlWithOptions, toHtmlWithRenderers, toHtmlWithReport, toHtmlWithSymbols, toMarkdown, toMarkdownWithOptions, toMarkdownWithReport, toPlainText, toPlainTextWithOptions, toPlainTextWithReport, toProseMirror, version
8
+ ParserSession, applyAstPatch, applyProfile, applyReversibleAstPatch, applySourcePatch, astJsonToAnsi, astJsonToCarve, astJsonToHtml, astJsonToMarkdown, astJsonToPlainText, createAstPatch, createReversibleAstPatch, createSourcePatch, expandIncludes, extensions, fromBbcode, fromDjot, fromHtml, fromMarkdown, fromProseMirror, htmlToAst, htmlToCarve, lintAccessibility, lintCarve, lintCarveWithOptions, markdownToAstJson, mergeAst, migrateBbcode, migrateDjot, needsReview, parseJson, parseJsonWithOptions, parseLocator, parseSnapshot, parseSourceLayoutJson, readStamp, reparse, sanitizeSvg, stampCarve, toAnsi, toAnsiWithOptions, toAnsiWithReport, toCarve, toCarvePatch, toCarveWithOptions, toCarveWithReport, toHtml, toHtmlFull, toHtmlWithOptions, toHtmlWithRenderers, toHtmlWithReport, toHtmlWithSymbols, toMarkdown, toMarkdownWithOptions, toMarkdownWithReport, toPlainText, toPlainTextWithOptions, toPlainTextWithReport, toProseMirror, version
9
9
  } from "./carve_wasm_bg.js";