punctilio 4.3.1 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +37 -23
  2. package/dist/constants.d.ts +0 -27
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +0 -40
  5. package/dist/constants.js.map +1 -1
  6. package/dist/dashes.d.ts +11 -7
  7. package/dist/dashes.d.ts.map +1 -1
  8. package/dist/dashes.js +423 -284
  9. package/dist/dashes.js.map +1 -1
  10. package/dist/index.d.ts +14 -118
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +65 -116
  13. package/dist/index.js.map +1 -1
  14. package/dist/markdown.js +1 -1
  15. package/dist/markdown.js.map +1 -1
  16. package/dist/nbsp.d.ts +19 -13
  17. package/dist/nbsp.d.ts.map +1 -1
  18. package/dist/nbsp.js +214 -69
  19. package/dist/nbsp.js.map +1 -1
  20. package/dist/prose-view.d.ts +48 -7
  21. package/dist/prose-view.d.ts.map +1 -1
  22. package/dist/prose-view.js +163 -27
  23. package/dist/prose-view.js.map +1 -1
  24. package/dist/quote-classifier.d.ts +5 -4
  25. package/dist/quote-classifier.d.ts.map +1 -1
  26. package/dist/quote-classifier.js +601 -88
  27. package/dist/quote-classifier.js.map +1 -1
  28. package/dist/quotes.d.ts +12 -4
  29. package/dist/quotes.d.ts.map +1 -1
  30. package/dist/quotes.js +24 -27
  31. package/dist/quotes.js.map +1 -1
  32. package/dist/rehype.d.ts +53 -8
  33. package/dist/rehype.d.ts.map +1 -1
  34. package/dist/rehype.js +105 -62
  35. package/dist/rehype.js.map +1 -1
  36. package/dist/remark.d.ts +1 -1
  37. package/dist/remark.d.ts.map +1 -1
  38. package/dist/remark.js +6 -9
  39. package/dist/remark.js.map +1 -1
  40. package/dist/symbols.d.ts +25 -14
  41. package/dist/symbols.d.ts.map +1 -1
  42. package/dist/symbols.js +812 -220
  43. package/dist/symbols.js.map +1 -1
  44. package/dist/transform-options.d.ts +97 -0
  45. package/dist/transform-options.d.ts.map +1 -0
  46. package/dist/transform-options.js +34 -0
  47. package/dist/transform-options.js.map +1 -0
  48. package/dist/utils.d.ts +0 -16
  49. package/dist/utils.d.ts.map +1 -1
  50. package/dist/utils.js +0 -56
  51. package/dist/utils.js.map +1 -1
  52. package/package.json +8 -3
  53. package/src/constants.ts +0 -46
  54. package/src/dashes.ts +450 -269
  55. package/src/index.ts +70 -291
  56. package/src/markdown.ts +1 -1
  57. package/src/nbsp.ts +255 -78
  58. package/src/prose-view.ts +234 -39
  59. package/src/quote-classifier.ts +618 -88
  60. package/src/quotes.ts +36 -19
  61. package/src/rehype.ts +169 -88
  62. package/src/remark.ts +6 -11
  63. package/src/symbols.ts +814 -251
  64. package/src/transform-options.ts +143 -0
  65. package/src/utils.ts +0 -82
package/dist/nbsp.js CHANGED
@@ -1,4 +1,5 @@
1
- import { cachedRegExp, getEscapedSeparator, LATIN_LETTERS, NBSP_CHARS, SPACE_CHARS, UNICODE_SYMBOLS, wordBoundaryEnd } from "./constants.js";
1
+ import { cachedRegExp, LATIN_LETTERS, NBSP_CHARS, SPACE_CHARS, UNICODE_SYMBOLS } from "./constants.js";
2
+ import { boundaryCountAt, overInput, replaceAllInView } from "./prose-view.js";
2
3
  const { NBSP, LEFT_DOUBLE_QUOTE, RIGHT_DOUBLE_QUOTE, LEFT_SINGLE_QUOTE, RIGHT_SINGLE_QUOTE, COPYRIGHT, REGISTERED, TRADEMARK, } = UNICODE_SYMBOLS;
3
4
  const SPACE = `[${SPACE_CHARS}]`;
4
5
  const UNICODE_UPPERCASE = "\\p{Lu}";
@@ -75,82 +76,226 @@ const HONORIFIC_PATTERN = HONORIFICS.map((h) => `${h}\\.`).join("|");
75
76
  const ABBREVIATION_PATTERN = REFERENCE_ABBREVIATIONS.map((a) => `${a}\\.`).join("|");
76
77
  const PUNCTUATION_OR_QUOTE = `[.,!?:;)(${LEFT_DOUBLE_QUOTE}${RIGHT_DOUBLE_QUOTE}\u00AB\u00BB${LEFT_SINGLE_QUOTE}${RIGHT_SINGLE_QUOTE}"]`;
77
78
  const COPYRIGHT_SYMBOLS = `[${COPYRIGHT}${REGISTERED}${TRADEMARK}]`;
78
- // Skips when preceded by NBSP or back-to-back with the previous match,
79
- // preventing 3+ words from binding into a single line-break atom.
80
- export function nbspAfterShortWords(text, options = {}) {
81
- const sep = getEscapedSeparator(options);
82
- const pattern = cachedRegExp(`(?<=^|${SPACE}|${PUNCTUATION_OR_QUOTE}|>)(?<shortWord>[${LATIN_LETTERS}]{1,2})(?<marker>${sep}?)${SPACE}`, "gmu");
83
- let previousMatchEnd = -1;
84
- return text.replace(pattern, (match, shortWord, marker, offset) => {
85
- if (offset === previousMatchEnd)
86
- return match;
87
- if (offset > 0 && NBSP_CHARS.includes(text[offset - 1]))
88
- return match;
89
- previousMatchEnd = offset + match.length;
90
- return `${shortWord}${marker}${NBSP}`;
91
- });
79
+ // The boundary-tolerance positions in this module reproduce the element-boundary
80
+ // semantics of the pre-v5 sentinel-marked pipeline; they are pinned by the golden
81
+ // corpus and the migration's differential fuzz.
82
+ /**
83
+ * A tolerated slot admits exactly ONE node boundary at that position; two
84
+ * adjacent boundaries block the match. This enforces that: at most one boundary
85
+ * at `offset`, and every interior boundary in the span must sit at one of the
86
+ * allowed slot offsets.
87
+ */
88
+ function boundariesOnlyAtSlots(view, start, end, slots) {
89
+ for (const boundary of view.boundaries) {
90
+ if (boundary <= start || boundary >= end)
91
+ continue;
92
+ if (!slots.includes(boundary))
93
+ return false;
94
+ }
95
+ for (const slot of slots) {
96
+ if (boundaryCountAt(view, slot) > 1)
97
+ return false;
98
+ }
99
+ return true;
92
100
  }
93
- export function nbspBetweenNumberAndUnit(text, options = {}) {
94
- const sep = getEscapedSeparator(options);
95
- const wbe = wordBoundaryEnd(sep);
96
- const pattern = cachedRegExp(`(?<digit>\\d)(?<marker1>${sep}?)${SPACE}(?<marker2>${sep}?)(?<unit>${UNIT_PATTERN})${wbe}`, "gm");
97
- return text.replace(pattern, `$<digit>$<marker1>${NBSP}$<marker2>$<unit>`);
101
+ export function nbspAfterShortWords(input) {
102
+ return overInput(input, nbspAfterShortWordsOverView);
103
+ }
104
+ function nbspAfterShortWordsOverView(view) {
105
+ const pattern = cachedRegExp(`(?<=^|${SPACE}|${PUNCTUATION_OR_QUOTE}|>)(?<shortWord>[${LATIN_LETTERS}]{1,2})${SPACE}`, "gmu");
106
+ {
107
+ const clean = view.text;
108
+ let previousMatchEnd = -1;
109
+ replaceAllInView(view, pattern, (match, v) => {
110
+ const offset = match.index;
111
+ if (offset === previousMatchEnd)
112
+ return null;
113
+ // A boundary directly before the short word fails the
114
+ // `(?<=^|space|punct|>)` lookbehind (a boundary is not one of those).
115
+ if (view.hasBoundary(offset))
116
+ return null;
117
+ if (offset > 0 && NBSP_CHARS.includes(clean[offset - 1]))
118
+ return null;
119
+ previousMatchEnd = offset + match[0].length;
120
+ // Edit only the space so any boundary keeps its side of the NBSP.
121
+ v.replace(offset + match[0].length - 1, offset + match[0].length, NBSP);
122
+ return null;
123
+ }, {
124
+ allowBoundaries: (match, v) => boundariesOnlyAtSlots(v, match.index, match.index + match[0].length, [
125
+ match.index + match[0].length - 1,
126
+ ]),
127
+ });
128
+ }
129
+ view.commit();
130
+ }
131
+ export function nbspBetweenNumberAndUnit(input) {
132
+ return overInput(input, nbspBetweenNumberAndUnitOverView);
133
+ }
134
+ function nbspBetweenNumberAndUnitOverView(view) {
135
+ const pattern = cachedRegExp(`(?<digit>\\d)${SPACE}(?<unit>${UNIT_PATTERN})\\b`, "gm");
136
+ {
137
+ replaceAllInView(view, pattern, (match, v) => {
138
+ // Edit only the space (after the single digit) so any boundaries keep
139
+ // their sides.
140
+ v.replace(match.index + 1, match.index + 2, NBSP);
141
+ return null;
142
+ }, {
143
+ // Tolerated slots: between digit and space (index+1) and between space
144
+ // and unit (index+2). The unit literal itself must be boundary-free,
145
+ // which the default interior-boundary skip already enforces.
146
+ allowBoundaries: (match, v) => boundariesOnlyAtSlots(v, match.index, match.index + match[0].length, [
147
+ match.index + 1,
148
+ match.index + 2,
149
+ ]),
150
+ });
151
+ }
152
+ view.commit();
98
153
  }
99
154
  const MAX_LAST_WORD_LENGTH = 10;
100
155
  // Bounded so the lookbehind stays ReDoS-safe.
101
156
  const MAX_MIDDLE_WORD_LENGTH = 15;
102
- // Skips when the second-to-last word is already glued backwards via NBSP.
103
- export function nbspBeforeLastWord(text, options = {}) {
104
- const sep = getEscapedSeparator(options);
105
- const cascadeBlock = `(?<![${NBSP_CHARS}][${LATIN_LETTERS}]{1,${MAX_MIDDLE_WORD_LENGTH}})`;
106
- // Use alternation instead of character classes for multi-char separator support
107
- const pattern = cachedRegExp(`${cascadeBlock}(?<=\\w|${sep})${SPACE}(?<lastWord>(?:(?!\\s)(?!${sep}).){1,${MAX_LAST_WORD_LENGTH}})(?<ending>${sep}?(?:\\n\\n|$))`, "g");
108
- return text.replace(pattern, `${NBSP}$<lastWord>$<ending>`);
109
- }
110
- export function nbspAfterReferenceAbbreviations(text, options = {}) {
111
- const sep = getEscapedSeparator(options);
112
- const pattern = cachedRegExp(`(?<abbrev>${ABBREVIATION_PATTERN})(?<marker>${sep}?)${SPACE}(?=${sep}?\\d)`, "g");
113
- return text.replace(pattern, `$<abbrev>$<marker>${NBSP}`);
114
- }
115
- export function nbspAfterSectionSymbols(text, options = {}) {
116
- const sep = getEscapedSeparator(options);
117
- const pattern = cachedRegExp(`(?<symbol>[§¶])(?<marker>${sep}?)${SPACE}(?=${sep}?\\d)`, "g");
118
- return text.replace(pattern, `$<symbol>$<marker>${NBSP}`);
119
- }
120
- export function nbspAfterHonorifics(text, options = {}) {
121
- const sep = getEscapedSeparator(options);
122
- const pattern = cachedRegExp(`(?<honorific>${HONORIFIC_PATTERN})(?<marker>${sep}?)${SPACE}(?=${sep}?${UNICODE_UPPERCASE})`, "gu");
123
- return text.replace(pattern, `$<honorific>$<marker>${NBSP}`);
124
- }
125
- export function nbspAfterCopyrightSymbols(text, options = {}) {
126
- const sep = getEscapedSeparator(options);
127
- const pattern = cachedRegExp(`(?<symbol>${COPYRIGHT_SYMBOLS})(?<marker>${sep}?)${SPACE}(?=${sep}?[\\d${UNICODE_UPPERCASE}])`, "gu");
128
- return text.replace(pattern, `$<symbol>$<marker>${NBSP}`);
129
- }
130
- export function nbspBetweenInitials(text, options = {}) {
131
- const sep = getEscapedSeparator(options);
132
- const pattern = cachedRegExp(`(?<initial>${UNICODE_UPPERCASE}\\.)(?<marker>${sep}?)${SPACE}(?=${sep}?${UNICODE_UPPERCASE})`, "gu");
133
- return text.replace(pattern, `$<initial>$<marker>${NBSP}`);
157
+ const LATIN_LETTER_RE = cachedRegExp(`[${LATIN_LETTERS}]`, "u");
158
+ /**
159
+ * The cascade lookbehind `(?<![NBSP][LATIN]{1,15})` over clean text: blocks
160
+ * when an NBSP/NNBSP is followed by 1..15 Latin letters ending at the space. A
161
+ * node boundary anywhere in that backward run breaks the run, re-enabling the
162
+ * match.
163
+ */
164
+ function cascadeBlocksLastWord(view, spaceOffset) {
165
+ const text = view.text;
166
+ let j = spaceOffset - 1;
167
+ let run = 0;
168
+ while (j >= 0 && run < MAX_MIDDLE_WORD_LENGTH && !view.hasBoundary(j + 1) && LATIN_LETTER_RE.test(text[j])) {
169
+ j--;
170
+ run++;
171
+ }
172
+ if (run === 0 || view.hasBoundary(j + 1))
173
+ return false;
174
+ return j >= 0 && NBSP_CHARS.includes(text[j]);
175
+ }
176
+ export function nbspBeforeLastWord(input) {
177
+ return overInput(input, nbspBeforeLastWordOverView);
178
+ }
179
+ function nbspBeforeLastWordOverView(view) {
180
+ // The `(?<=\w|boundary)` lookbehind and the `[NBSP][LATIN]{1,15}` cascade
181
+ // lookbehind are enforced in the replacer, where boundaries are visible.
182
+ const pattern = cachedRegExp(`${SPACE}(?<lastWord>(?:(?!\\s).){1,${MAX_LAST_WORD_LENGTH}})(?<ending>\\n\\n|$)`, "g");
183
+ {
184
+ const clean = view.text;
185
+ replaceAllInView(view, pattern, (match, v) => {
186
+ const start = match.index;
187
+ const end = start + match[0].length;
188
+ // `(?<=\w|sep)`: a word char before the space, or a boundary there.
189
+ const precededByWord = start > 0 && /\w/.test(clean[start - 1]);
190
+ if (!precededByWord && !view.hasBoundary(start))
191
+ return null;
192
+ if (cascadeBlocksLastWord(v, start))
193
+ return null;
194
+ // The `ending` group tolerates exactly one boundary at the slot before
195
+ // `\n\n`/end-of-text; two adjacent boundaries block the match. The
196
+ // end-of-text slot sits at the match end (never an interior boundary),
197
+ // so the cap is checked here rather than only in allowBoundaries.
198
+ if (boundaryCountAt(v, end - match.groups.ending.length) > 1)
199
+ return null;
200
+ // Edit only the leading space so the lastWord/ending (and any boundary
201
+ // before \n\n) keep their positions.
202
+ v.replace(start, start + 1, NBSP);
203
+ return null;
204
+ }, {
205
+ // The space-lookbehind boundary (== match.index) is not interior. The
206
+ // last word admits no interior boundary, so a boundary inside it blocks
207
+ // the match (the default skip). The only interior slot is the `ending`
208
+ // group's slot before a `\n\n`: one boundary tolerated.
209
+ allowBoundaries: (match, v) => {
210
+ const end = match.index + match[0].length;
211
+ const endingSlot = end - match.groups.ending.length;
212
+ return boundariesOnlyAtSlots(v, match.index, end, [endingSlot]);
213
+ },
214
+ });
215
+ }
216
+ view.commit();
217
+ }
218
+ /**
219
+ * Shared driver for the abbreviation-family rules: `(thing)(SPACE)(?=context)`
220
+ * where the slot between thing and space and the lookahead slot (between space
221
+ * and context) each tolerate one boundary.
222
+ */
223
+ function nbspBeforeContext(view, thingPattern, contextPattern, flags, thingGroup) {
224
+ const pattern = cachedRegExp(`(?<${thingGroup}>${thingPattern})${SPACE}(?=${contextPattern})`, flags);
225
+ {
226
+ const clean = view.text;
227
+ pattern.lastIndex = 0;
228
+ let match;
229
+ while ((match = pattern.exec(clean)) !== null) {
230
+ const start = match.index;
231
+ const end = start + match[0].length;
232
+ // Slot between the `thing` literal and the space (offset = end - 1);
233
+ // lookahead slot at the match end. Each tolerates one boundary; the
234
+ // literal itself must be boundary-free.
235
+ const allowed = boundariesOnlyAtSlots(view, start, end, [end - 1]) && boundaryCountAt(view, end) <= 1;
236
+ if (!allowed) {
237
+ // A boundary broke the (possibly longer) literal; let the scan re-anchor
238
+ // one position later so a shorter sub-abbreviation can still match.
239
+ pattern.lastIndex = start + 1;
240
+ continue;
241
+ }
242
+ // Edit only the trailing space so the slot/lookahead boundaries keep their
243
+ // sides.
244
+ view.replace(end - 1, end, NBSP);
245
+ }
246
+ }
247
+ view.commit();
248
+ }
249
+ function nbspAfterReferenceAbbreviationsOverView(view) {
250
+ nbspBeforeContext(view, ABBREVIATION_PATTERN, "\\d", "g", "abbrev");
251
+ }
252
+ function nbspAfterSectionSymbolsOverView(view) {
253
+ nbspBeforeContext(view, "[\u00A7\u00B6]", "\\d", "g", "symbol");
254
+ }
255
+ function nbspAfterHonorificsOverView(view) {
256
+ nbspBeforeContext(view, HONORIFIC_PATTERN, UNICODE_UPPERCASE, "gu", "honorific");
257
+ }
258
+ function nbspAfterCopyrightSymbolsOverView(view) {
259
+ nbspBeforeContext(view, COPYRIGHT_SYMBOLS, `[\\d${UNICODE_UPPERCASE}]`, "gu", "symbol");
260
+ }
261
+ function nbspBetweenInitialsOverView(view) {
262
+ nbspBeforeContext(view, `${UNICODE_UPPERCASE}\\.`, UNICODE_UPPERCASE, "gu", "initial");
263
+ }
264
+ export function nbspAfterReferenceAbbreviations(input) {
265
+ return overInput(input, nbspAfterReferenceAbbreviationsOverView);
266
+ }
267
+ export function nbspAfterSectionSymbols(input) {
268
+ return overInput(input, nbspAfterSectionSymbolsOverView);
269
+ }
270
+ export function nbspAfterHonorifics(input) {
271
+ return overInput(input, nbspAfterHonorificsOverView);
272
+ }
273
+ export function nbspAfterCopyrightSymbols(input) {
274
+ return overInput(input, nbspAfterCopyrightSymbolsOverView);
275
+ }
276
+ export function nbspBetweenInitials(input) {
277
+ return overInput(input, nbspBetweenInitialsOverView);
134
278
  }
135
279
  // Specific patterns first so they claim matches before generic nbspAfterShortWords.
136
280
  const NBSP_TRANSFORMS = [
137
- nbspAfterHonorifics,
138
- nbspAfterReferenceAbbreviations,
139
- nbspAfterSectionSymbols,
140
- nbspAfterCopyrightSymbols,
141
- nbspBetweenInitials,
142
- nbspBetweenNumberAndUnit,
143
- nbspAfterShortWords,
144
- nbspBeforeLastWord,
281
+ nbspAfterHonorificsOverView,
282
+ nbspAfterReferenceAbbreviationsOverView,
283
+ nbspAfterSectionSymbolsOverView,
284
+ nbspAfterCopyrightSymbolsOverView,
285
+ nbspBetweenInitialsOverView,
286
+ nbspBetweenNumberAndUnitOverView,
287
+ nbspAfterShortWordsOverView,
288
+ nbspBeforeLastWordOverView,
145
289
  ];
146
- export function nbspTransform(text, options = {}) {
147
- // All nbsp patterns require a space, tab, or existing nbsp to match.
148
- // Short-circuit if the text contains none of these.
149
- if (!cachedRegExp(`[${SPACE_CHARS}]`, "").test(text))
150
- return text;
151
- for (const fn of NBSP_TRANSFORMS) {
152
- text = fn(text, options);
153
- }
154
- return text;
290
+ export function nbspTransform(input) {
291
+ return overInput(input, (view) => {
292
+ // All nbsp patterns require a space, tab, or existing nbsp to match.
293
+ // Short-circuit if the text contains none of these.
294
+ if (!cachedRegExp(`[${SPACE_CHARS}]`, "").test(view.text))
295
+ return;
296
+ for (const fn of NBSP_TRANSFORMS) {
297
+ fn(view);
298
+ }
299
+ });
155
300
  }
156
301
  //# sourceMappingURL=nbsp.js.map
package/dist/nbsp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"nbsp.js","sourceRoot":"","sources":["../src/nbsp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE5I,MAAM,EACJ,IAAI,EACJ,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,SAAS,GACV,GA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+BAA+B,CAAC,KAAyB;IACvE,OAAO,SAAS,CAAC,KAAK,EAAE,uCAAuC,CAAC,CAAA;AAClE,CAAC;AAID,MAAM,UAAU,uBAAuB,CAAC,KAAyB;IAC/D,OAAO,SAAS,CAAC,KAAK,EAAE,+BAA+B,CAAC,CAAA;AAC1D,CAAC;AAID,MAAM,UAAU,mBAAmB,CAAC,KAAyB;IAC3D,OAAO,SAAS,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAA;AACtD,CAAC;AAID,MAAM,UAAU,yBAAyB,CAAC,KAAyB;IACjE,OAAO,SAAS,CAAC,KAAK,EAAE,iCAAiC,CAAC,CAAA;AAC5D,CAAC;AAID,MAAM,UAAU,mBAAmB,CAAC,KAAyB;IAC3D,OAAO,SAAS,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAA;AACtD,CAAC;AAED,oFAAoF;AACpF,MAAM,eAAe,GAAkC;IACrD,2BAA2B;IAC3B,uCAAuC;IACvC,+BAA+B;IAC/B,iCAAiC;IACjC,2BAA2B;IAC3B,gCAAgC;IAChC,2BAA2B;IAC3B,0BAA0B;CAC3B,CAAA;AAID,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;QAC/B,qEAAqE;QACrE,oDAAoD;QACpD,IAAI,CAAC,YAAY,CAAC,IAAI,WAAW,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAM;QAEjE,KAAK,MAAM,EAAE,IAAI,eAAe,EAAE,CAAC;YACjC,EAAE,CAAC,IAAI,CAAC,CAAA;QACV,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -26,12 +26,53 @@ export interface ReplaceAllOptions {
26
26
  export declare function boundaryCountAt(view: ProseView, offset: number): number;
27
27
  export declare function replaceAllInView(view: ProseView, regex: RegExp, replacer: (match: RegExpExecArray, view: ProseView) => string | null, options?: ReplaceAllOptions): void;
28
28
  /**
29
- * Splits sentinel-marked text on the separator, builds a ProseView over the
30
- * fragments, runs `run` against the clean-text view, commits the queued edits,
31
- * and rejoins the fragments with the separator. The separator count is
32
- * preserved exactly: each fragment maps to one source node, and `commit()`
33
- * never creates or destroys node boundaries.
29
+ * String↔view bridge: builds a single-node ProseView over `text`, runs `run`
30
+ * against it, commits any queued edits, and returns the resulting text.
34
31
  */
35
- export declare function withProseView(markedText: string, separator: string, run: (view: ProseView) => void): string;
36
- export declare function runLegacyPass(view: ProseView, passFn: (markedText: string) => string, separator?: string): void;
32
+ export declare function withProseView(text: string, run: (view: ProseView) => void): string;
33
+ /**
34
+ * A pass with the same dual-input shape as the built-ins (`niceQuotes`,
35
+ * `hyphenReplace`, ...): string in, transformed string out; ProseView in,
36
+ * edits committed onto it in place.
37
+ */
38
+ export type ProsePass = {
39
+ (input: string): string;
40
+ (input: ProseView): void;
41
+ };
42
+ export interface DefinePassOptions {
43
+ /**
44
+ * How matches that contain an interior node boundary are handled:
45
+ *
46
+ * - `"skip"` (default, safe): such matches are left untouched, so a pass
47
+ * never rewrites text that spans two source nodes.
48
+ * - `"allow"`: such matches are always replaced; the replacement text lands
49
+ * in the node containing the match start, collapsing the boundary after it.
50
+ * - predicate: forwarded as `allowBoundaries` to {@link replaceAllInView};
51
+ * return `true` to allow that particular boundary-spanning match.
52
+ */
53
+ boundaries?: "skip" | "allow" | ((match: RegExpExecArray, view: ProseView) => boolean);
54
+ }
55
+ /**
56
+ * Defines a boundary-aware pass with the same dual-input shape as the
57
+ * built-in passes, suitable for composing with them (e.g. via `applyPasses`
58
+ * from `punctilio/rehype`).
59
+ *
60
+ * `replacement` is either a template string (supporting `$$`, `$&`,
61
+ * `$1`–`$99`, and `$<name>`; any other `$` form throws at definition time)
62
+ * or a replacer `(match, view) => string | null`, where `null` leaves that
63
+ * match untouched.
64
+ *
65
+ * Patterns that can match the empty string (e.g. pure lookarounds) insert
66
+ * the replacement at every position they match; prefer patterns that
67
+ * consume at least one character.
68
+ */
69
+ export declare function definePass(pattern: RegExp, replacement: string | ((match: RegExpExecArray, view: ProseView) => string | null), options?: DefinePassOptions): ProsePass;
70
+ /**
71
+ * Dual-input driver shared by the public passes: a string runs through a
72
+ * single-node view and returns the transformed string; a ProseView has the
73
+ * pass's edits queued and committed onto it in place (returns nothing).
74
+ */
75
+ export declare function overInput(input: string, run: (view: ProseView) => void): string;
76
+ export declare function overInput(input: ProseView, run: (view: ProseView) => void): void;
77
+ export declare function overInput(input: string | ProseView, run: (view: ProseView) => void): string | void;
37
78
  //# sourceMappingURL=prose-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prose-view.d.ts","sourceRoot":"","sources":["../src/prose-view.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2KAA2K;IAC3K,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,iFAAiF;IACjF,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IACpC,oGAAoG;IACpG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IAC3F,2KAA2K;IAC3K,MAAM,IAAI,IAAI,CAAA;CACf;AAkND,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,CAE5D;AAED,MAAM,WAAW,iBAAiB;IAChC,wGAAwG;IACxG,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAA;IACtE,2EAA2E;IAC3E,IAAI,CAAC,EAA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