@orkestrel/guide 0.0.32 → 0.0.33

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.
@@ -257,6 +257,28 @@ export declare function collectTitles(guide: GuideInterface, source: SourceInter
257
257
  */
258
258
  export declare function compareMembership(spec: string, name: string, documented: readonly string[], declared: readonly string[]): ParityFinding | undefined;
259
259
 
260
+ /**
261
+ * Measures how many terminal columns `text` occupies the way the checkout's formatter pads a
262
+ * Markdown table cell: each grapheme cluster counts two columns when it is wide — a character
263
+ * of the East Asian wide and fullwidth blocks, an emoji, or a sequence of them — and otherwise
264
+ * one column per character that has a width, with marks, format characters, and control
265
+ * characters counting none.
266
+ *
267
+ * @remarks
268
+ * The count is of the cell's source text, so an escaped pipe counts two columns, as it does in the
269
+ * file. An ambiguous-width character such as an arrow counts one column, the width the formatter
270
+ * gives it.
271
+ *
272
+ * @param text - The cell's source text
273
+ * @returns The columns `text` occupies
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * computeCellWidth('`walk`') // 6
278
+ * ```
279
+ */
280
+ export declare function computeCellWidth(text: string): number;
281
+
260
282
  /**
261
283
  * Computes the bracket depth of every character of projected declaration code: an opening `(`,
262
284
  * `[`, `{`, or `<` and its closing partner carry the depth outside the pair, the characters
@@ -589,6 +611,13 @@ export declare function createDriftContract(): ContractInterface<Drift>;
589
611
  source: OptionalShape<StringShape>;
590
612
  }, false>;
591
613
 
614
+ /**
615
+ * Matches a grapheme cluster the formatter counts two columns whole: a pictograph sequence joined
616
+ * by a zero width joiner, an emoji followed by a skin-tone modifier, an emoji followed by the emoji
617
+ * variation selector, or a keycap that carries that selector.
618
+ */
619
+ export declare const EMOJI_SEQUENCE: RegExp;
620
+
592
621
  /**
593
622
  * Lists the declaration keywords a documented or exported symbol carries, in the order the
594
623
  * reflection grammar names them — the frozen population `ExportKeyword`, `isExportKeyword`, and
@@ -2216,6 +2245,35 @@ export declare function createDriftContract(): ContractInterface<Drift>;
2216
2245
  */
2217
2246
  export declare function renderExample(example: SourceExample): string;
2218
2247
 
2248
+ /**
2249
+ * Renders `table` as the bytes the checkout's formatter writes for it: every column padded to
2250
+ * its widest cell, at least three columns wide, each cell justified to its column's alignment,
2251
+ * and a delimiter row of dashes the column's width carrying the alignment's colons.
2252
+ *
2253
+ * @remarks
2254
+ * `renderMarkdown` writes every cell one-space padded, so a rewritten table that passed straight
2255
+ * through it would fail the formatter's check and need a formatter pass. This render pads from
2256
+ * that output instead of re-deriving it, so the cell text is `renderMarkdown`'s and only the
2257
+ * padding is this function's: a cell is measured by {@link computeCellWidth}, a left or unaligned
2258
+ * cell pads on the right, a right-aligned cell on the left, and a centred cell on both sides with
2259
+ * the odd column on the right.
2260
+ *
2261
+ * @param table - The table to render
2262
+ * @returns The table's markdown source, with no trailing newline
2263
+ *
2264
+ * @example
2265
+ * ```ts
2266
+ * renderMarkdownTable({
2267
+ * element: 'table',
2268
+ * header: [[{ element: 'text', value: 'Name' }], [{ element: 'text', value: 'Summary' }]],
2269
+ * rows: [[[{ element: 'codeSpan', value: 'walk' }], [{ element: 'text', value: 'Walks.' }]]],
2270
+ * align: [null, null],
2271
+ * })
2272
+ * // '| Name | Summary |\n| ------ | ------- |\n| `walk` | Walks. |'
2273
+ * ```
2274
+ */
2275
+ export declare function renderMarkdownTable(table: TableNode): string;
2276
+
2219
2277
  /**
2220
2278
  * Renders one emitted interface member as its signature entry: a property as its name, an
2221
2279
  * optional one with `?`, a method as `name()` or `name?()`, an accessor as its name, and a call,
@@ -2299,9 +2357,10 @@ export declare function createDriftContract(): ContractInterface<Drift>;
2299
2357
  * a rewrite would re-pad the whole table for no change; that identity reads both cells through
2300
2358
  * {@link extractCellText} and {@link normalizeSummary}, so a caller passing text the compared form
2301
2359
  * still moves is a fixed point on the second run rather than a row rewritten forever. The
2302
- * rewritten table renders one-space padded whatever padding it carried, so the checkout's
2303
- * formatter re-aligns it, and a code span renders with every `|` written `\|` and a longer
2304
- * backtick fence when its text holds a backtick.
2360
+ * rewritten table renders through {@link renderMarkdownTable}, so every row of it is padded as the
2361
+ * checkout's formatter pads a table whatever padding it carried and the formatter's check passes
2362
+ * on the result, and a code span renders with every `|` written `\|` and a longer backtick fence
2363
+ * when its text holds a backtick.
2305
2364
  *
2306
2365
  * @param guide - The guide's markdown source
2307
2366
  * @param key - The compared key naming the row
@@ -2312,7 +2371,7 @@ export declare function createDriftContract(): ContractInterface<Drift>;
2312
2371
  * @example
2313
2372
  * ```ts
2314
2373
  * replaceCell('## Surface\n\n| Name | Kind | Signature | Summary |\n| --- | --- | --- | --- |\n| `walk` | function | `() => void` | Walks. |', 'function walk', SUMMARY, buildCell('Walks a tree.'))
2315
- * // '## Surface\n\n| Name | Kind | Signature | Summary |\n| --- | --- | --- | --- |\n| `walk` | function | `() => void` | Walks a tree. |'
2374
+ * // '## Surface\n\n| Name | Kind | Signature | Summary |\n| ------ | -------- | ------------ | ------------- |\n| `walk` | function | `() => void` | Walks a tree. |'
2316
2375
  * ```
2317
2376
  */
2318
2377
  export declare function replaceCell(guide: string, key: string, column: string, cell: readonly InlineNode[]): string | undefined;
@@ -3070,6 +3129,20 @@ export declare function createDriftContract(): ContractInterface<Drift>;
3070
3129
  */
3071
3130
  export declare function validateSurface(document: MarkdownDocument): void;
3072
3131
 
3132
+ /**
3133
+ * Matches one character that occupies two terminal columns: an emoji presentation character other
3134
+ * than a regional indicator, or a character of the East Asian wide and fullwidth classes.
3135
+ *
3136
+ * @remarks
3137
+ * A regional indicator is outside this class because the formatter counts each as one column,
3138
+ * which makes a flag pair two. The blocks are the formatter's Unicode tables, so an unassigned
3139
+ * code point, a character the formatter's Unicode version classes differently from a later one,
3140
+ * and a ligating cluster such as Arabic lam-alef, which the formatter counts one column, are the
3141
+ * measure's known divergences. A character in {@link ZERO_WIDTH} counts none
3142
+ * whatever this class holds, because the width measure tests that class first.
3143
+ */
3144
+ export declare const WIDE_CHARACTER: RegExp;
3145
+
3073
3146
  /**
3074
3147
  * Holds the default character budget a rewritten doc block's description paragraph wraps
3075
3148
  * inside — the greatest number of characters a re-wrapped line may carry, counted from the
@@ -3102,4 +3175,11 @@ export declare function createDriftContract(): ContractInterface<Drift>;
3102
3175
  */
3103
3176
  export declare function wrapText(text: string, width: number): readonly string[];
3104
3177
 
3178
+ /**
3179
+ * Matches a character that occupies no terminal column: a nonspacing, enclosing, or extending
3180
+ * mark, a format character such as a zero width space, a control character, and the Hangul
3181
+ * medial and final jamo, less the format and mark characters the formatter counts one column.
3182
+ */
3183
+ export declare const ZERO_WIDTH: RegExp;
3184
+
3105
3185
  export { }
@@ -257,6 +257,28 @@ export declare function collectTitles(guide: GuideInterface, source: SourceInter
257
257
  */
258
258
  export declare function compareMembership(spec: string, name: string, documented: readonly string[], declared: readonly string[]): ParityFinding | undefined;
259
259
 
260
+ /**
261
+ * Measures how many terminal columns `text` occupies the way the checkout's formatter pads a
262
+ * Markdown table cell: each grapheme cluster counts two columns when it is wide — a character
263
+ * of the East Asian wide and fullwidth blocks, an emoji, or a sequence of them — and otherwise
264
+ * one column per character that has a width, with marks, format characters, and control
265
+ * characters counting none.
266
+ *
267
+ * @remarks
268
+ * The count is of the cell's source text, so an escaped pipe counts two columns, as it does in the
269
+ * file. An ambiguous-width character such as an arrow counts one column, the width the formatter
270
+ * gives it.
271
+ *
272
+ * @param text - The cell's source text
273
+ * @returns The columns `text` occupies
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * computeCellWidth('`walk`') // 6
278
+ * ```
279
+ */
280
+ export declare function computeCellWidth(text: string): number;
281
+
260
282
  /**
261
283
  * Computes the bracket depth of every character of projected declaration code: an opening `(`,
262
284
  * `[`, `{`, or `<` and its closing partner carry the depth outside the pair, the characters
@@ -589,6 +611,13 @@ export declare function createDriftContract(): ContractInterface<Drift>;
589
611
  source: OptionalShape<StringShape>;
590
612
  }, false>;
591
613
 
614
+ /**
615
+ * Matches a grapheme cluster the formatter counts two columns whole: a pictograph sequence joined
616
+ * by a zero width joiner, an emoji followed by a skin-tone modifier, an emoji followed by the emoji
617
+ * variation selector, or a keycap that carries that selector.
618
+ */
619
+ export declare const EMOJI_SEQUENCE: RegExp;
620
+
592
621
  /**
593
622
  * Lists the declaration keywords a documented or exported symbol carries, in the order the
594
623
  * reflection grammar names them — the frozen population `ExportKeyword`, `isExportKeyword`, and
@@ -2216,6 +2245,35 @@ export declare function createDriftContract(): ContractInterface<Drift>;
2216
2245
  */
2217
2246
  export declare function renderExample(example: SourceExample): string;
2218
2247
 
2248
+ /**
2249
+ * Renders `table` as the bytes the checkout's formatter writes for it: every column padded to
2250
+ * its widest cell, at least three columns wide, each cell justified to its column's alignment,
2251
+ * and a delimiter row of dashes the column's width carrying the alignment's colons.
2252
+ *
2253
+ * @remarks
2254
+ * `renderMarkdown` writes every cell one-space padded, so a rewritten table that passed straight
2255
+ * through it would fail the formatter's check and need a formatter pass. This render pads from
2256
+ * that output instead of re-deriving it, so the cell text is `renderMarkdown`'s and only the
2257
+ * padding is this function's: a cell is measured by {@link computeCellWidth}, a left or unaligned
2258
+ * cell pads on the right, a right-aligned cell on the left, and a centred cell on both sides with
2259
+ * the odd column on the right.
2260
+ *
2261
+ * @param table - The table to render
2262
+ * @returns The table's markdown source, with no trailing newline
2263
+ *
2264
+ * @example
2265
+ * ```ts
2266
+ * renderMarkdownTable({
2267
+ * element: 'table',
2268
+ * header: [[{ element: 'text', value: 'Name' }], [{ element: 'text', value: 'Summary' }]],
2269
+ * rows: [[[{ element: 'codeSpan', value: 'walk' }], [{ element: 'text', value: 'Walks.' }]]],
2270
+ * align: [null, null],
2271
+ * })
2272
+ * // '| Name | Summary |\n| ------ | ------- |\n| `walk` | Walks. |'
2273
+ * ```
2274
+ */
2275
+ export declare function renderMarkdownTable(table: TableNode): string;
2276
+
2219
2277
  /**
2220
2278
  * Renders one emitted interface member as its signature entry: a property as its name, an
2221
2279
  * optional one with `?`, a method as `name()` or `name?()`, an accessor as its name, and a call,
@@ -2299,9 +2357,10 @@ export declare function createDriftContract(): ContractInterface<Drift>;
2299
2357
  * a rewrite would re-pad the whole table for no change; that identity reads both cells through
2300
2358
  * {@link extractCellText} and {@link normalizeSummary}, so a caller passing text the compared form
2301
2359
  * still moves is a fixed point on the second run rather than a row rewritten forever. The
2302
- * rewritten table renders one-space padded whatever padding it carried, so the checkout's
2303
- * formatter re-aligns it, and a code span renders with every `|` written `\|` and a longer
2304
- * backtick fence when its text holds a backtick.
2360
+ * rewritten table renders through {@link renderMarkdownTable}, so every row of it is padded as the
2361
+ * checkout's formatter pads a table whatever padding it carried and the formatter's check passes
2362
+ * on the result, and a code span renders with every `|` written `\|` and a longer backtick fence
2363
+ * when its text holds a backtick.
2305
2364
  *
2306
2365
  * @param guide - The guide's markdown source
2307
2366
  * @param key - The compared key naming the row
@@ -2312,7 +2371,7 @@ export declare function createDriftContract(): ContractInterface<Drift>;
2312
2371
  * @example
2313
2372
  * ```ts
2314
2373
  * replaceCell('## Surface\n\n| Name | Kind | Signature | Summary |\n| --- | --- | --- | --- |\n| `walk` | function | `() => void` | Walks. |', 'function walk', SUMMARY, buildCell('Walks a tree.'))
2315
- * // '## Surface\n\n| Name | Kind | Signature | Summary |\n| --- | --- | --- | --- |\n| `walk` | function | `() => void` | Walks a tree. |'
2374
+ * // '## Surface\n\n| Name | Kind | Signature | Summary |\n| ------ | -------- | ------------ | ------------- |\n| `walk` | function | `() => void` | Walks a tree. |'
2316
2375
  * ```
2317
2376
  */
2318
2377
  export declare function replaceCell(guide: string, key: string, column: string, cell: readonly InlineNode[]): string | undefined;
@@ -3070,6 +3129,20 @@ export declare function createDriftContract(): ContractInterface<Drift>;
3070
3129
  */
3071
3130
  export declare function validateSurface(document: MarkdownDocument): void;
3072
3131
 
3132
+ /**
3133
+ * Matches one character that occupies two terminal columns: an emoji presentation character other
3134
+ * than a regional indicator, or a character of the East Asian wide and fullwidth classes.
3135
+ *
3136
+ * @remarks
3137
+ * A regional indicator is outside this class because the formatter counts each as one column,
3138
+ * which makes a flag pair two. The blocks are the formatter's Unicode tables, so an unassigned
3139
+ * code point, a character the formatter's Unicode version classes differently from a later one,
3140
+ * and a ligating cluster such as Arabic lam-alef, which the formatter counts one column, are the
3141
+ * measure's known divergences. A character in {@link ZERO_WIDTH} counts none
3142
+ * whatever this class holds, because the width measure tests that class first.
3143
+ */
3144
+ export declare const WIDE_CHARACTER: RegExp;
3145
+
3073
3146
  /**
3074
3147
  * Holds the default character budget a rewritten doc block's description paragraph wraps
3075
3148
  * inside — the greatest number of characters a re-wrapped line may carry, counted from the
@@ -3102,4 +3175,11 @@ export declare function createDriftContract(): ContractInterface<Drift>;
3102
3175
  */
3103
3176
  export declare function wrapText(text: string, width: number): readonly string[];
3104
3177
 
3178
+ /**
3179
+ * Matches a character that occupies no terminal column: a nonspacing, enclosing, or extending
3180
+ * mark, a format character such as a zero width space, a control character, and the Hangul
3181
+ * medial and final jamo, less the format and mark characters the formatter counts one column.
3182
+ */
3183
+ export declare const ZERO_WIDTH: RegExp;
3184
+
3105
3185
  export { }
@@ -110,6 +110,53 @@ var EXTERNAL_SCHEMES = Object.freeze([
110
110
  "mailto:",
111
111
  "tel:"
112
112
  ]);
113
+ /**
114
+ * Matches one character that occupies two terminal columns: an emoji presentation character other
115
+ * than a regional indicator, or a character of the East Asian wide and fullwidth classes.
116
+ *
117
+ * @remarks
118
+ * A regional indicator is outside this class because the formatter counts each as one column,
119
+ * which makes a flag pair two. The blocks are the formatter's Unicode tables, so an unassigned
120
+ * code point, a character the formatter's Unicode version classes differently from a later one,
121
+ * and a ligating cluster such as Arabic lam-alef, which the formatter counts one column, are the
122
+ * measure's known divergences. A character in {@link ZERO_WIDTH} counts none
123
+ * whatever this class holds, because the width measure tests that class first.
124
+ */
125
+ var WIDE_CHARACTER = new RegExp([
126
+ String.raw`[[\p{Emoji_Presentation}--\p{Regional_Indicator}]`,
127
+ String.raw`\u{1100}-\u{115F}\u{2329}\u{232A}\u{2630}-\u{2637}\u{268A}-\u{268F}`,
128
+ String.raw`\u{2E80}-\u{2E99}\u{2E9B}-\u{2EF3}\u{2F00}-\u{2FD5}\u{2FF0}-\u{303E}`,
129
+ String.raw`\u{3041}-\u{3096}\u{3099}-\u{30FF}\u{3105}-\u{312F}\u{3131}-\u{318E}`,
130
+ String.raw`\u{3190}-\u{31E5}\u{31EF}-\u{321E}\u{3220}-\u{3247}\u{3250}-\u{A48C}`,
131
+ String.raw`\u{A490}-\u{A4C6}\u{A960}-\u{A97C}\u{AC00}-\u{D7A3}\u{F900}-\u{FAFF}`,
132
+ String.raw`\u{FE10}-\u{FE19}\u{FE30}-\u{FE52}\u{FE54}-\u{FE66}\u{FE68}-\u{FE6B}`,
133
+ String.raw`\u{FF01}-\u{FF60}\u{FFE0}-\u{FFE6}`,
134
+ String.raw`\u{16FE0}-\u{16FE3}\u{16FF0}-\u{16FF6}\u{17000}-\u{187FF}`,
135
+ String.raw`\u{18800}-\u{18CD5}\u{18CFF}-\u{18D1E}\u{18D80}-\u{18DF2}`,
136
+ String.raw`\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}`,
137
+ String.raw`\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}`,
138
+ String.raw`\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1D300}-\u{1D356}`,
139
+ String.raw`\u{1D360}-\u{1D376}\u{1F200}\u{1F202}\u{1F210}-\u{1F219}`,
140
+ String.raw`\u{1F21B}-\u{1F22E}\u{1F230}\u{1F231}\u{1F237}\u{1F23B}`,
141
+ String.raw`\u{1F240}-\u{1F248}\u{1F250}\u{1F251}\u{1F260}-\u{1F265}`,
142
+ String.raw`\u{20000}-\u{2FFFD}\u{30000}-\u{3FFFD}]`
143
+ ].join(""), "v");
144
+ /**
145
+ * Matches a character that occupies no terminal column: a nonspacing, enclosing, or extending
146
+ * mark, a format character such as a zero width space, a control character, and the Hangul
147
+ * medial and final jamo, less the format and mark characters the formatter counts one column.
148
+ */
149
+ var ZERO_WIDTH = new RegExp([
150
+ String.raw`[[\p{Grapheme_Extend}\p{Cf}\p{Cc}\u{1160}-\u{11FF}\u{D7B0}-\u{D7C6}\u{D7CB}-\u{D7FB}`,
151
+ String.raw`\u{3164}\u{FFA0}]--[\u{600}-\u{604}\u{6DD}\u{2D7F}\u{FFF9}-\u{FFFB}`,
152
+ String.raw`\u{110BD}\u{110CD}\u{13430}-\u{1343F}]]`
153
+ ].join(""), "v");
154
+ /**
155
+ * Matches a grapheme cluster the formatter counts two columns whole: a pictograph sequence joined
156
+ * by a zero width joiner, an emoji followed by a skin-tone modifier, an emoji followed by the emoji
157
+ * variation selector, or a keycap that carries that selector.
158
+ */
159
+ var EMOJI_SEQUENCE = /\p{Extended_Pictographic}\u{200D}\p{Extended_Pictographic}|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}|\p{Emoji}\u{FE0F}|[0-9#*]\u{FE0F}\u{20E3}/u;
113
160
  // src/core/errors.ts
114
161
  /** Carries a coded refusal of a guide, a manifest entry, or a module compile. */
115
162
  var GuideError = class extends Error {
@@ -2981,6 +3028,79 @@ function buildTable(table, row, column, cell) {
2981
3028
  };
2982
3029
  }
2983
3030
  /**
3031
+ * Measures how many terminal columns `text` occupies the way the checkout's formatter pads a
3032
+ * Markdown table cell: each grapheme cluster counts two columns when it is wide — a character
3033
+ * of the East Asian wide and fullwidth blocks, an emoji, or a sequence of them — and otherwise
3034
+ * one column per character that has a width, with marks, format characters, and control
3035
+ * characters counting none.
3036
+ *
3037
+ * @remarks
3038
+ * The count is of the cell's source text, so an escaped pipe counts two columns, as it does in the
3039
+ * file. An ambiguous-width character such as an arrow counts one column, the width the formatter
3040
+ * gives it.
3041
+ *
3042
+ * @param text - The cell's source text
3043
+ * @returns The columns `text` occupies
3044
+ *
3045
+ * @example
3046
+ * ```ts
3047
+ * computeCellWidth('`walk`') // 6
3048
+ * ```
3049
+ */
3050
+ function computeCellWidth(text) {
3051
+ return Iterator.from(new Intl.Segmenter().segment(text)).reduce((total, { segment }) => EMOJI_SEQUENCE.test(segment) ? total + 2 : Iterator.from(segment).reduce((sum, character) => ZERO_WIDTH.test(character) ? sum : sum + (WIDE_CHARACTER.test(character) ? 2 : 1), total), 0);
3052
+ }
3053
+ /**
3054
+ * Renders `table` as the bytes the checkout's formatter writes for it: every column padded to
3055
+ * its widest cell, at least three columns wide, each cell justified to its column's alignment,
3056
+ * and a delimiter row of dashes the column's width carrying the alignment's colons.
3057
+ *
3058
+ * @remarks
3059
+ * `renderMarkdown` writes every cell one-space padded, so a rewritten table that passed straight
3060
+ * through it would fail the formatter's check and need a formatter pass. This render pads from
3061
+ * that output instead of re-deriving it, so the cell text is `renderMarkdown`'s and only the
3062
+ * padding is this function's: a cell is measured by {@link computeCellWidth}, a left or unaligned
3063
+ * cell pads on the right, a right-aligned cell on the left, and a centred cell on both sides with
3064
+ * the odd column on the right.
3065
+ *
3066
+ * @param table - The table to render
3067
+ * @returns The table's markdown source, with no trailing newline
3068
+ *
3069
+ * @example
3070
+ * ```ts
3071
+ * renderMarkdownTable({
3072
+ * element: 'table',
3073
+ * header: [[{ element: 'text', value: 'Name' }], [{ element: 'text', value: 'Summary' }]],
3074
+ * rows: [[[{ element: 'codeSpan', value: 'walk' }], [{ element: 'text', value: 'Walks.' }]]],
3075
+ * align: [null, null],
3076
+ * })
3077
+ * // '| Name | Summary |\n| ------ | ------- |\n| `walk` | Walks. |'
3078
+ * ```
3079
+ */
3080
+ function renderMarkdownTable(table) {
3081
+ const [header = "", , ...body] = renderMarkdown(table).split("\n");
3082
+ const rows = [header, ...body].map((line) => line.slice(2, -2).split(" | "));
3083
+ const widths = table.header.map((_, column) => Math.max(3, ...rows.map((cells) => computeCellWidth(cells[column] ?? ""))));
3084
+ const lines = rows.map((cells) => `| ${widths.map((width, column) => {
3085
+ const cell = cells[column] ?? "";
3086
+ const spare = width - computeCellWidth(cell);
3087
+ const align = table.align[column];
3088
+ const before = align === "right" ? spare : align === "center" ? Math.floor(spare / 2) : 0;
3089
+ return `${" ".repeat(before)}${cell}${" ".repeat(spare - before)}`;
3090
+ }).join(" | ")} |`);
3091
+ const delimiter = widths.map((width, column) => {
3092
+ const align = table.align[column];
3093
+ const left = align === "left" || align === "center" ? ":" : "-";
3094
+ const right = align === "right" || align === "center" ? ":" : "-";
3095
+ return `${left}${"-".repeat(width - 2)}${right}`;
3096
+ });
3097
+ return [
3098
+ lines[0],
3099
+ `| ${delimiter.join(" | ")} |`,
3100
+ ...lines.slice(1)
3101
+ ].join("\n");
3102
+ }
3103
+ /**
2984
3104
  * Builds the fenced code block one `@example` block renders as — its code inside a fence
2985
3105
  * carrying its language, and an untagged fence when the block names none.
2986
3106
  *
@@ -3178,9 +3298,10 @@ function renderExample(example) {
3178
3298
  * a rewrite would re-pad the whole table for no change; that identity reads both cells through
3179
3299
  * {@link extractCellText} and {@link normalizeSummary}, so a caller passing text the compared form
3180
3300
  * still moves is a fixed point on the second run rather than a row rewritten forever. The
3181
- * rewritten table renders one-space padded whatever padding it carried, so the checkout's
3182
- * formatter re-aligns it, and a code span renders with every `|` written `\|` and a longer
3183
- * backtick fence when its text holds a backtick.
3301
+ * rewritten table renders through {@link renderMarkdownTable}, so every row of it is padded as the
3302
+ * checkout's formatter pads a table whatever padding it carried and the formatter's check passes
3303
+ * on the result, and a code span renders with every `|` written `\|` and a longer backtick fence
3304
+ * when its text holds a backtick.
3184
3305
  *
3185
3306
  * @param guide - The guide's markdown source
3186
3307
  * @param key - The compared key naming the row
@@ -3191,7 +3312,7 @@ function renderExample(example) {
3191
3312
  * @example
3192
3313
  * ```ts
3193
3314
  * replaceCell('## Surface\n\n| Name | Kind | Signature | Summary |\n| --- | --- | --- | --- |\n| `walk` | function | `() => void` | Walks. |', 'function walk', SUMMARY, buildCell('Walks a tree.'))
3194
- * // '## Surface\n\n| Name | Kind | Signature | Summary |\n| --- | --- | --- | --- |\n| `walk` | function | `() => void` | Walks a tree. |'
3315
+ * // '## Surface\n\n| Name | Kind | Signature | Summary |\n| ------ | -------- | ------------ | ------------- |\n| `walk` | function | `() => void` | Walks a tree. |'
3195
3316
  * ```
3196
3317
  */
3197
3318
  function replaceCell(guide, key, column, cell) {
@@ -3216,7 +3337,7 @@ function replaceCell(guide, key, column, cell) {
3216
3337
  if (normalizeSummary(extractCellText(table.rows[index]?.[position] ?? [])) === normalizeSummary(extractCellText(cell))) return guide;
3217
3338
  const span = markdown.span(table);
3218
3339
  if (span === void 0) return void 0;
3219
- return spliceSpan(guide, span, renderMarkdown(buildTable(table, index, position, cell)));
3340
+ return spliceSpan(guide, span, renderMarkdownTable(buildTable(table, index, position, cell)));
3220
3341
  }
3221
3342
  /**
3222
3343
  * Replaces one titled fence in a guide's text and returns the whole guide back. The first fence
@@ -4642,6 +4763,6 @@ function createMethodGroupContract() {
4642
4763
  function createManifestEntryContract() {
4643
4764
  return createContract(manifestEntryShape);
4644
4765
  }
4645
- export { DRIFT_CATEGORIES, EXPORT_KEYWORDS, EXTERNAL_SCHEMES, GUIDE_CODES, GUIDE_ERROR_BRAND, Guide, GuideError, KIND, MANIFEST, METHODS, NAME, Parity, SIGNATURE, SUMMARY, SURFACE, SURFACE_HEADER, Source, SourceManager, TESTS, WRAP_WIDTH, buildCell, buildComment, buildFence, buildTable, collectDeclarations, collectExamples, collectFences, collectGroups, collectKeys, collectSummaries, collectTitles, compareMembership, computeDepths, computeDrift, computeModuleKey, computeSymbolKey, createDriftContract, createGuide, createManifestEntryContract, createMethodEntryContract, createMethodGroupContract, createSource, createSourceExampleContract, createSourceManager, createSurfaceSymbolContract, driftShape, extractBodyLines, extractCellLinks, extractCellText, extractDeclaration, extractExampleLines, extractExampleMethods, extractExamples, extractExports, extractFenceImports, extractFences, extractHidden, extractLinks, extractMemberMethods, extractMethods, extractRowEntry, extractRowSummary, extractRowSymbol, extractSignature, extractSignatures, extractSourceComments, extractSourceLines, extractSurface, extractTagline, extractTests, extractUnnamed, findClosing, findColumnIndex, findDrift, findFirstCode, findMissing, findMissingSymbols, findSeparators, findUnexampled, findUnlisted, formatDrift, formatSide, hasBehaviouralSurface, hasCanonicalSegments, identifyDrift, isDrift, isDriftCategory, isExportKeyword, isExternalLink, isGuideError, isManifestEntry, isMethodEntry, isMethodGroup, isSourceExample, isSurfaceSymbol, joinHead, locateComment, manifestEntryShape, maskFences, methodEntryShape, methodGroupShape, normalizeComment, normalizeDirectories, normalizeIdentifier, normalizeSummary, parseManifest, renderExample, renderMember, renderMethods, renderSurface, replaceCell, replaceExample, replaceFence, replaceSummary, resolveLink, resolvePath, selectModuleKeys, selectSectionBlocks, sourceExampleShape, spliceSpan, surfaceSymbolShape, unwrapComment, validateModules, validateSurface, wrapText };
4766
+ export { DRIFT_CATEGORIES, EMOJI_SEQUENCE, EXPORT_KEYWORDS, EXTERNAL_SCHEMES, GUIDE_CODES, GUIDE_ERROR_BRAND, Guide, GuideError, KIND, MANIFEST, METHODS, NAME, Parity, SIGNATURE, SUMMARY, SURFACE, SURFACE_HEADER, Source, SourceManager, TESTS, WIDE_CHARACTER, WRAP_WIDTH, ZERO_WIDTH, buildCell, buildComment, buildFence, buildTable, collectDeclarations, collectExamples, collectFences, collectGroups, collectKeys, collectSummaries, collectTitles, compareMembership, computeCellWidth, computeDepths, computeDrift, computeModuleKey, computeSymbolKey, createDriftContract, createGuide, createManifestEntryContract, createMethodEntryContract, createMethodGroupContract, createSource, createSourceExampleContract, createSourceManager, createSurfaceSymbolContract, driftShape, extractBodyLines, extractCellLinks, extractCellText, extractDeclaration, extractExampleLines, extractExampleMethods, extractExamples, extractExports, extractFenceImports, extractFences, extractHidden, extractLinks, extractMemberMethods, extractMethods, extractRowEntry, extractRowSummary, extractRowSymbol, extractSignature, extractSignatures, extractSourceComments, extractSourceLines, extractSurface, extractTagline, extractTests, extractUnnamed, findClosing, findColumnIndex, findDrift, findFirstCode, findMissing, findMissingSymbols, findSeparators, findUnexampled, findUnlisted, formatDrift, formatSide, hasBehaviouralSurface, hasCanonicalSegments, identifyDrift, isDrift, isDriftCategory, isExportKeyword, isExternalLink, isGuideError, isManifestEntry, isMethodEntry, isMethodGroup, isSourceExample, isSurfaceSymbol, joinHead, locateComment, manifestEntryShape, maskFences, methodEntryShape, methodGroupShape, normalizeComment, normalizeDirectories, normalizeIdentifier, normalizeSummary, parseManifest, renderExample, renderMarkdownTable, renderMember, renderMethods, renderSurface, replaceCell, replaceExample, replaceFence, replaceSummary, resolveLink, resolvePath, selectModuleKeys, selectSectionBlocks, sourceExampleShape, spliceSpan, surfaceSymbolShape, unwrapComment, validateModules, validateSurface, wrapText };
4646
4767
 
4647
4768
  //# sourceMappingURL=index.js.map