@cudoment/cudoc 0.4.0 → 0.6.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.
Files changed (102) hide show
  1. package/README.md +4 -3
  2. package/dist/document.d.ts +36 -1
  3. package/dist/document.d.ts.map +1 -1
  4. package/dist/document.js +54 -3
  5. package/dist/document.js.map +1 -1
  6. package/dist/internal/core/mdx/imports.d.ts +21 -0
  7. package/dist/internal/core/mdx/imports.d.ts.map +1 -0
  8. package/dist/internal/core/mdx/imports.js +80 -0
  9. package/dist/internal/core/mdx/imports.js.map +1 -0
  10. package/dist/internal/core/mdx/index.d.ts +1 -0
  11. package/dist/internal/core/mdx/index.d.ts.map +1 -1
  12. package/dist/internal/core/mdx/index.js +1 -0
  13. package/dist/internal/core/mdx/index.js.map +1 -1
  14. package/dist/internal/core/query/sections.d.ts +6 -0
  15. package/dist/internal/core/query/sections.d.ts.map +1 -1
  16. package/dist/internal/core/query/sections.js +8 -2
  17. package/dist/internal/core/query/sections.js.map +1 -1
  18. package/dist/internal/transforms/table-column-layout/create-table.d.ts.map +1 -1
  19. package/dist/internal/transforms/table-column-layout/create-table.js +40 -17
  20. package/dist/internal/transforms/table-column-layout/create-table.js.map +1 -1
  21. package/dist/internal/transforms/table-column-layout/index.d.ts +32 -0
  22. package/dist/internal/transforms/table-column-layout/index.d.ts.map +1 -1
  23. package/dist/internal/transforms/table-column-layout/index.js +66 -0
  24. package/dist/internal/transforms/table-column-layout/index.js.map +1 -1
  25. package/dist/markdown.d.ts +8 -0
  26. package/dist/markdown.d.ts.map +1 -1
  27. package/dist/markdown.js +9 -1
  28. package/dist/markdown.js.map +1 -1
  29. package/dist/node/check.d.ts +12 -6
  30. package/dist/node/check.d.ts.map +1 -1
  31. package/dist/node/check.js +460 -79
  32. package/dist/node/check.js.map +1 -1
  33. package/dist/node/cli.js +2 -56
  34. package/dist/node/cli.js.map +1 -1
  35. package/dist/node/collect.d.ts +41 -0
  36. package/dist/node/collect.d.ts.map +1 -0
  37. package/dist/node/collect.js +351 -0
  38. package/dist/node/collect.js.map +1 -0
  39. package/dist/node/command.d.ts +23 -0
  40. package/dist/node/command.d.ts.map +1 -0
  41. package/dist/node/command.js +116 -0
  42. package/dist/node/command.js.map +1 -0
  43. package/dist/node/dataset.d.ts +14 -1
  44. package/dist/node/dataset.d.ts.map +1 -1
  45. package/dist/node/dataset.js +44 -5
  46. package/dist/node/dataset.js.map +1 -1
  47. package/dist/node/glob.d.ts +21 -0
  48. package/dist/node/glob.d.ts.map +1 -0
  49. package/dist/node/glob.js +61 -0
  50. package/dist/node/glob.js.map +1 -0
  51. package/dist/node/library.d.ts +76 -6
  52. package/dist/node/library.d.ts.map +1 -1
  53. package/dist/node/library.js +63 -137
  54. package/dist/node/library.js.map +1 -1
  55. package/dist/node/load-ast.d.ts.map +1 -1
  56. package/dist/node/load-ast.js +4 -1
  57. package/dist/node/load-ast.js.map +1 -1
  58. package/dist/node/local-target.d.ts +39 -8
  59. package/dist/node/local-target.d.ts.map +1 -1
  60. package/dist/node/local-target.js +94 -13
  61. package/dist/node/local-target.js.map +1 -1
  62. package/dist/node/prepare-embeds.d.ts +52 -3
  63. package/dist/node/prepare-embeds.d.ts.map +1 -1
  64. package/dist/node/prepare-embeds.js +134 -8
  65. package/dist/node/prepare-embeds.js.map +1 -1
  66. package/dist/node/references.d.ts +39 -0
  67. package/dist/node/references.d.ts.map +1 -0
  68. package/dist/node/references.js +101 -0
  69. package/dist/node/references.js.map +1 -0
  70. package/dist/node/replace.d.ts +65 -0
  71. package/dist/node/replace.d.ts.map +1 -0
  72. package/dist/node/replace.js +285 -0
  73. package/dist/node/replace.js.map +1 -0
  74. package/dist/node/resolve-embed.d.ts +79 -1
  75. package/dist/node/resolve-embed.d.ts.map +1 -1
  76. package/dist/node/resolve-embed.js +480 -143
  77. package/dist/node/resolve-embed.js.map +1 -1
  78. package/dist/node/roots.d.ts +78 -0
  79. package/dist/node/roots.d.ts.map +1 -0
  80. package/dist/node/roots.js +170 -0
  81. package/dist/node/roots.js.map +1 -0
  82. package/dist/node/storage.d.ts +21 -3
  83. package/dist/node/storage.d.ts.map +1 -1
  84. package/dist/node/storage.js +242 -20
  85. package/dist/node/storage.js.map +1 -1
  86. package/dist/node/watch.d.ts +86 -0
  87. package/dist/node/watch.d.ts.map +1 -0
  88. package/dist/node/watch.js +174 -0
  89. package/dist/node/watch.js.map +1 -0
  90. package/dist/paged.d.ts +34 -0
  91. package/dist/paged.d.ts.map +1 -0
  92. package/dist/paged.js +44 -0
  93. package/dist/paged.js.map +1 -0
  94. package/dist/render.d.ts +1 -1
  95. package/dist/render.d.ts.map +1 -1
  96. package/dist/render.js +14 -0
  97. package/dist/render.js.map +1 -1
  98. package/dist/sections.d.ts.map +1 -1
  99. package/dist/sections.js +7 -3
  100. package/dist/sections.js.map +1 -1
  101. package/package.json +29 -16
  102. package/styles.css +5 -2
@@ -0,0 +1,285 @@
1
+ /**
2
+ * Replacement rules applied to an embedded section, shared by the resolver,
3
+ * which copies the result, and the checker, which inspects it.
4
+ *
5
+ * A rule list rewrites the section's original Markdown, not its tree, and the
6
+ * rewritten text is compiled again with the document's own options, so the
7
+ * copy is what the source would have been had it been written that way.
8
+ */
9
+ import { compileDocument } from "../markdown.js";
10
+ import { getHeadingAnchorId } from "../internal/core/query/sections.js";
11
+ import { sourceFileOf } from "./roots.js";
12
+ /** Hosts whose Markdown the standalone compiler reads as the host does. */
13
+ const PORTABLE_HOSTS = ["markdown", "next", "html"];
14
+ /** A block a heading can sit in, as an author calls it. */
15
+ const containerName = (node) => {
16
+ if (node.type === "blockquote") {
17
+ const element = node.data?.hName;
18
+ if (element === "aside")
19
+ return "a callout";
20
+ return element && element !== "blockquote" ? "a container" : "a quote";
21
+ }
22
+ if (node.type === "listItem")
23
+ return "a list item";
24
+ if (node.type === "containerDirective")
25
+ return "a container";
26
+ if (node.type === "mdxJsxFlowElement")
27
+ return "a component";
28
+ if (node.type === "footnoteDefinition")
29
+ return "a footnote";
30
+ return `a ${node.type} block`;
31
+ };
32
+ /** Columns a line's leading text takes, with a tab to the next multiple of four. */
33
+ const width = (value) => [...value].reduce((column, char) => (char === "\t" ? column + 4 - (column % 4) : column + 1), 0);
34
+ /** A line less up to `column` columns of its leading white space. */
35
+ const dedent = (line, column) => {
36
+ let at = 0;
37
+ let index = 0;
38
+ while (at < column && (line[index] === " " || line[index] === "\t")) {
39
+ const next = line[index] === "\t" ? at + 4 - (at % 4) : at + 1;
40
+ // A tab reaching past the column leaves the columns beyond it.
41
+ if (next > column)
42
+ return " ".repeat(next - column) + line.slice(index + 1);
43
+ at = next;
44
+ index++;
45
+ }
46
+ return line.slice(index);
47
+ };
48
+ /**
49
+ * Where a section's heading sits: the block holding it, and the marks of
50
+ * the blocks around it on its own line. A remark host records the heading
51
+ * after them and a markdown-it host from the start of the line, so they are
52
+ * read from the line itself.
53
+ */
54
+ const headingPlace = (document, anchor) => {
55
+ const source = document.source;
56
+ const range = source?.sections[anchor];
57
+ if (!source || !range)
58
+ return undefined;
59
+ const root = document.tree;
60
+ let found;
61
+ const find = (node) => (node.children ?? []).forEach((child, index) => {
62
+ if (found)
63
+ return;
64
+ if (child.type === "heading" &&
65
+ getHeadingAnchorId(child) === anchor)
66
+ found = { parent: node, index };
67
+ else
68
+ find(child);
69
+ });
70
+ find(root);
71
+ if (!found || found.parent === root)
72
+ return undefined;
73
+ const text = source.text;
74
+ const lineStart = text.lastIndexOf("\n", range.start - 1) + 1;
75
+ const lineEnd = text.indexOf("\n", lineStart);
76
+ const line = text.slice(lineStart, lineEnd === -1 ? text.length : lineEnd);
77
+ const marks = line.match(MARKS)[0];
78
+ return {
79
+ ...found,
80
+ range,
81
+ marks,
82
+ lineStart,
83
+ included: range.start - lineStart,
84
+ };
85
+ };
86
+ /**
87
+ * The marks of the blocks a line opens or continues: quotes, list items,
88
+ * indentation. A line may still end in the `\r` of a `\r\n`.
89
+ */
90
+ const MARKS = /^(?:[ \t]*(?:>|[-+*](?=[ \t\r]|$)|\d{1,9}[.)](?=[ \t\r]|$)))*[ \t]*/;
91
+ const LIST_MARKER = /(?:[-+*]|\d[.)])/;
92
+ /**
93
+ * The column a list item's content starts at, for a heading on one of its
94
+ * later lines: that of the nearest line above whose marks open an item no
95
+ * deeper than the heading, since the heading may be indented past it. An
96
+ * item whose first line holds the marker alone starts one column past the
97
+ * marker, however much space follows it.
98
+ */
99
+ const itemColumn = (text, lineStart, heading) => {
100
+ let end = lineStart - 1;
101
+ while (end > 0) {
102
+ const start = text.lastIndexOf("\n", end - 1) + 1;
103
+ const line = text.slice(start, end);
104
+ const marks = line.match(MARKS)[0];
105
+ const column = line.slice(marks.length).trim() === ""
106
+ ? width(marks.trimEnd()) + 1
107
+ : width(marks);
108
+ if (LIST_MARKER.test(marks) && column <= heading)
109
+ return column;
110
+ end = start - 1;
111
+ }
112
+ return heading;
113
+ };
114
+ /**
115
+ * One section's Markdown as it reads on its own, or the whole document's
116
+ * without an anchor. A heading in a list item starts its range at or after
117
+ * the item's marks, and the lines after it carry the indentation the parser
118
+ * took off them as the item's content; both are taken off here too, so the
119
+ * text compiles to the section that was collected.
120
+ */
121
+ export function sectionText(document, anchor, includeChildren = true) {
122
+ const source = document.source;
123
+ const range = anchor ? source.sections[anchor] : undefined;
124
+ if (!range)
125
+ return source.text;
126
+ const text = source.text.slice(range.start, includeChildren ? range.end : (range.ownEnd ?? range.end));
127
+ const place = headingPlace(document, anchor);
128
+ if (place?.parent.type !== "listItem" || place.marks.includes(">"))
129
+ return text;
130
+ const column = LIST_MARKER.test(place.marks)
131
+ ? width(place.marks)
132
+ : itemColumn(source.text, place.lineStart, width(place.marks));
133
+ const [first = "", ...rest] = text.split("\n");
134
+ return [
135
+ first.slice(Math.max(0, place.marks.length - place.included)),
136
+ ...rest.map((line) => dedent(line, column)),
137
+ ].join("\n");
138
+ }
139
+ /**
140
+ * Why a section's Markdown cannot be rewritten, or `undefined`.
141
+ *
142
+ * A rule rewrites the section's text as it reads on its own, which is
143
+ * compiled again. A heading inside another block leaves some of that block
144
+ * in the text where nothing takes it off: a quote's `>` stays on the lines
145
+ * after the heading, a footnote's indentation stays on its lines, and the
146
+ * last section of a component or a `:::` container runs into the line that
147
+ * closes it. Any of those is refused, since compiled again it would be
148
+ * another structure; a list item's marks and indentation are taken off by
149
+ * `sectionText`. Decided from the collected tree and the source alone, so
150
+ * the build and `cudoc check` agree whichever compiler each has.
151
+ */
152
+ export function unreplaceableSection(document, anchor, includeChildren = true) {
153
+ if (!anchor)
154
+ return undefined;
155
+ const place = headingPlace(document, anchor);
156
+ if (!place)
157
+ return undefined;
158
+ const { parent, index, marks } = place;
159
+ const heading = parent.children[index];
160
+ const endsWithin = parent
161
+ .children.slice(index + 1)
162
+ .some((node) => node.type === "heading" &&
163
+ (!includeChildren || (node.depth ?? 0) <= (heading.depth ?? 0)));
164
+ const quoted = marks.includes(">");
165
+ const closed = parent.type === "mdxJsxFlowElement" ||
166
+ parent.type === "containerDirective" ||
167
+ (parent.type === "blockquote" && !quoted);
168
+ const lastLine = sectionText(document, anchor, includeChildren)
169
+ .trimEnd()
170
+ .split("\n")
171
+ .at(-1)
172
+ .trim();
173
+ const reason = quoted
174
+ ? "the `>` marks stay on the lines after its heading"
175
+ : parent.type === "footnoteDefinition"
176
+ ? "the footnote's indentation stays on the lines after its heading"
177
+ : closed && !endsWithin && /^(?::{3,}|<\/[^>]*>)$/.test(lastLine)
178
+ ? "its text runs into the line that closes that block"
179
+ : undefined;
180
+ if (!reason)
181
+ return undefined;
182
+ const container = containerName(parent);
183
+ return `${document.id}#${anchor} starts inside ${container}, and ${reason}, so a replace rule cannot rewrite it; move the heading out of ${container.replace(/^an? /, "the ")}, or embed the section without replace`;
184
+ }
185
+ export function replaceSource(source, rules, documentId) {
186
+ return rules.reduce((value, rule, index) => {
187
+ try {
188
+ return rule.regex
189
+ ? value.replace(new RegExp(rule.find, rule.flags ?? "g"), rule.replace)
190
+ : value.split(rule.find).join(rule.replace);
191
+ }
192
+ catch (cause) {
193
+ throw new Error(`cudoc: invalid replacement ${index + 1} in ${documentId}`, { cause });
194
+ }
195
+ }, source);
196
+ }
197
+ /**
198
+ * One section's Markdown with the rules applied, followed by the definitions
199
+ * it depends on from outside its range, unchanged. `offset` is where the
200
+ * section starts in the source, for an error that has to point there.
201
+ */
202
+ export function replacedSectionSource(document, anchor, rules, includeChildren = true) {
203
+ if (!document.source)
204
+ throw new Error(`cudoc: rebuild ${document.id} with source snapshots before replacing Markdown`);
205
+ // The snapshot records one source range per id, the first heading's; a
206
+ // second heading with the same id has no range of its own to rewrite.
207
+ if (anchor) {
208
+ const parents = [];
209
+ const count = (node) => {
210
+ for (const child of node.children ?? []) {
211
+ if (child.type === "heading" &&
212
+ getHeadingAnchorId(child) === anchor)
213
+ parents.push(node);
214
+ count(child);
215
+ }
216
+ };
217
+ const root = document.tree;
218
+ count(root);
219
+ if (parents.length > 1)
220
+ throw new Error(`cudoc: ${document.id} gives #${anchor} to ${parents.length} headings, so a replace rule cannot tell which section to rewrite; give them distinct ids`);
221
+ const problem = unreplaceableSection(document, anchor, includeChildren);
222
+ if (problem)
223
+ throw new Error(`cudoc: ${problem}`);
224
+ }
225
+ const range = anchor ? document.source.sections[anchor] : undefined;
226
+ if (anchor && !range)
227
+ throw new Error(`cudoc: missing source range for ${document.id}#${anchor}; rebuild documents`);
228
+ const end = range
229
+ ? includeChildren
230
+ ? range.end
231
+ : (range.ownEnd ?? range.end)
232
+ : undefined;
233
+ const original = sectionText(document, anchor, includeChildren);
234
+ const dependencies = range?.dependencies
235
+ .filter(([start, stop]) => start < range.start || stop > end)
236
+ .map(([start, end]) => document.source.text.slice(start, end))
237
+ .join("\n\n");
238
+ return {
239
+ source: replaceSource(original, rules, document.id) +
240
+ (dependencies ? `\n\n${dependencies}` : ""),
241
+ offset: range?.start ?? 0,
242
+ };
243
+ }
244
+ /**
245
+ * Compiles a section's rewritten Markdown with the library's compiler and
246
+ * options, as the build does. A library of a host the standalone compiler
247
+ * cannot stand in for needs that host's compiler, and without it this throws,
248
+ * because a copy compiled otherwise would lose the host's own syntax.
249
+ *
250
+ * `standalone` is for a caller that inspects the copy rather than ships it:
251
+ * without the host compiler it compiles with the standalone one and the same
252
+ * options, which reads embed fences, components and tables as the host does.
253
+ * Syntax only the host's own parser knows is lost or refused there: a
254
+ * VitePress `::: tip` container stays text, and MDX with Docusaurus's
255
+ * `{#id}` or an HTML comment does not compile, which the caller has to allow.
256
+ */
257
+ export function compileReplacedSection(library, document, replaced, { standalone = false } = {}) {
258
+ const options = { ...library.options, format: document.source?.format };
259
+ if (!library.compiler &&
260
+ !standalone &&
261
+ options.host &&
262
+ !PORTABLE_HOSTS.includes(options.host))
263
+ throw new Error(`cudoc: replacing ${options.host} Markdown requires the original host compiler`);
264
+ try {
265
+ return library.compiler
266
+ ? library.compiler(replaced.source, {
267
+ id: document.id,
268
+ filePath: (library.roots &&
269
+ sourceFileOf(library.roots, document.sourcePath)) ??
270
+ document.sourcePath,
271
+ options,
272
+ }).tree
273
+ : compileDocument(replaced.source, options).tree;
274
+ }
275
+ catch (cause) {
276
+ throw new Error(`cudoc: replaced Markdown could not compile in ${document.id} at source offset ${replaced.offset}`, { cause });
277
+ }
278
+ }
279
+ /** The tree an embed copies from one section: rewritten when there are rules. */
280
+ export function transformedSection(document, anchor, tree, rules, library, includeChildren = true) {
281
+ if (!rules.length)
282
+ return structuredClone(tree);
283
+ return compileReplacedSection(library, document, replacedSectionSource(document, anchor, rules, includeChildren));
284
+ }
285
+ //# sourceMappingURL=replace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace.js","sourceRoot":"","sources":["../../src/node/replace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,2EAA2E;AAC3E,MA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EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,iDAAiD,QAAQ,CAAC,EAAE,qBAAqB,QAAQ,CAAC,MAAM,EAAE,EAClG,EAAE,KAAK,EAAE,CACV,CAAA;IACH,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,kBAAkB,CAChC,QAAwB,EACxB,MAA0B,EAC1B,IAAU,EACV,KAAoB,EACpB,OAAgB,EAChB,eAAe,GAAG,IAAI;IAEtB,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;IAC/C,OAAO,sBAAsB,CAC3B,OAAO,EACP,QAAQ,EACR,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,CAChE,CAAA;AACH,CAAC"}
@@ -7,12 +7,37 @@ export type Replacement = {
7
7
  regex?: boolean;
8
8
  flags?: string;
9
9
  };
10
+ /**
11
+ * Where a table cell's text comes from.
12
+ *
13
+ * `title`, `summary` and `parent` read the row's section; the coordinate form
14
+ * reads one cell of one table inside it, counting tables after those whose
15
+ * header row names a heading in `skipTablesWithHeaders`; `extractor` names a
16
+ * function the collection config registered.
17
+ */
18
+ export type CellValue = "title" | "summary" | "parent" | {
19
+ table?: number;
20
+ row: number;
21
+ column: number;
22
+ skipTablesWithHeaders?: string[];
23
+ } | {
24
+ extractor: string;
25
+ };
26
+ /** Where a cell links to: the row's section, the heading above it, or its document. */
27
+ export type CellLink = "section" | "parent" | "document";
28
+ export type TableColumn = "title" | "link" | "summary" | {
29
+ header?: string;
30
+ value: CellValue;
31
+ link?: CellLink;
32
+ /** A CSS length written onto the header cell's `style` as `min-width`. */
33
+ minWidth?: string;
34
+ };
10
35
  export type EmbedSpec = {
11
36
  sources: string[];
12
37
  select?: SectionSelection;
13
38
  render?: "section" | {
14
39
  type: "table";
15
- columns?: ("title" | "link" | "summary")[];
40
+ columns?: TableColumn[];
16
41
  };
17
42
  replace?: Replacement[];
18
43
  };
@@ -20,6 +45,40 @@ export type EmbedContext = {
20
45
  documentId: string;
21
46
  prefix?: string;
22
47
  };
48
+ /** What a cell shows: text, and a link when the column or extractor gives one. */
49
+ export type ExtractedCell = {
50
+ text: string;
51
+ url?: string;
52
+ };
53
+ /** One row of an extracted table: the selected section and where it sits. */
54
+ export type EmbedRow = {
55
+ document: StoredDocument;
56
+ section: {
57
+ anchorId?: string;
58
+ title: string;
59
+ tree: Root;
60
+ };
61
+ /** The nearest heading above the section that is shallower than it. */
62
+ parent?: {
63
+ title: string;
64
+ anchorId?: string;
65
+ };
66
+ /** The row section's own address. */
67
+ url: string;
68
+ };
69
+ /**
70
+ * A function the collection config registers to compute a cell. `version`
71
+ * enters the library configuration, so changing what the function returns
72
+ * for the same input invalidates prepared embeds.
73
+ */
74
+ export type TableExtractor = {
75
+ version: string;
76
+ extract: (row: EmbedRow, context: {
77
+ library: Library;
78
+ documentId: string;
79
+ column: TableColumn;
80
+ }) => string | ExtractedCell | undefined;
81
+ };
23
82
  export declare function parseEmbedSpec(value: string): EmbedSpec;
24
83
  /**
25
84
  * Parses one fenced block, naming the document and block when it fails.
@@ -34,6 +93,25 @@ export declare function resolveDocumentReference(library: Library, reference: st
34
93
  document: StoredDocument;
35
94
  anchor?: string;
36
95
  };
96
+ /** The default columns of a summary table, as they have always been. */
97
+ export declare const DEFAULT_TABLE_COLUMNS: TableColumn[];
98
+ /**
99
+ * One row for a selected section: what it is called, where it lives and which
100
+ * heading introduces the part of the document it sits in.
101
+ */
102
+ export declare function buildEmbedRow(document: StoredDocument, anchorId: string | undefined, tree: Root): EmbedRow;
103
+ /**
104
+ * The text and link one column shows for one row, and why it is empty when it
105
+ * is. The resolver renders the cell either way; the checker reports the
106
+ * problem, which is worded as what the column asked for and what the section
107
+ * has, so an author can tell a wrong coordinate from a missing table.
108
+ */
109
+ export declare function extractCell(library: Library, column: TableColumn, row: EmbedRow, context: EmbedContext): {
110
+ cell: ExtractedCell;
111
+ problem?: string;
112
+ };
113
+ /** The mdast table the extracted cells make, header cells carrying any width. */
114
+ export declare function buildEmbedTable(library: Library, columns: TableColumn[], rows: EmbedRow[], context: EmbedContext): Root;
37
115
  /** Resolve a configured embed from immutable persisted documents. */
38
116
  export declare function resolveEmbed(library: Library, input: EmbedSpec, context: EmbedContext): Root;
39
117
  export declare function resolveDocumentEmbeds(library: Library, documentId: string): Root;
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-embed.d.ts","sourceRoot":"","sources":["../../src/node/resolve-embed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAGjC,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGvE,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,MAAM,CAAC,EACL,SAAS,GAAG;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,CAAA;KAAE,CAAA;IAC3E,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;CACxB,CAAA;AACD,MAAM,MAAM,YAAY,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAMlE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAgFvD;AAKD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MA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