@mnaoumov/obsidian-lib 8.1.0 → 10.0.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.
- package/dist/lib/cjs/__merged.cjs +20 -13
- package/dist/lib/cjs/__merged.d.cts +3 -2
- package/dist/lib/cjs/canvas.cjs +7 -7
- package/dist/lib/cjs/components/rename-delete-handler-component.cjs +31 -31
- package/dist/lib/cjs/generated-during-build.cjs +1 -1
- package/dist/lib/cjs/index.cjs +4 -1
- package/dist/lib/cjs/index.d.cts +1 -0
- package/dist/lib/cjs/link.cjs +105 -105
- package/dist/lib/cjs/link.d.cts +88 -88
- package/dist/lib/cjs/metadata-cache.cjs +28 -28
- package/dist/lib/cjs/metadata-cache.d.cts +14 -13
- package/dist/lib/cjs/position.cjs +113 -0
- package/dist/lib/cjs/position.d.cts +55 -0
- package/dist/lib/cjs/reference.cjs +7 -7
- package/dist/lib/esm/__merged.d.mts +3 -2
- package/dist/lib/esm/__merged.mjs +21 -13
- package/dist/lib/esm/canvas.mjs +8 -8
- package/dist/lib/esm/components/rename-delete-handler-component.mjs +34 -34
- package/dist/lib/esm/generated-during-build.mjs +1 -1
- package/dist/lib/esm/index.d.mts +1 -0
- package/dist/lib/esm/index.mjs +3 -1
- package/dist/lib/esm/link.d.mts +88 -88
- package/dist/lib/esm/link.mjs +101 -101
- package/dist/lib/esm/metadata-cache.d.mts +14 -13
- package/dist/lib/esm/metadata-cache.mjs +27 -27
- package/dist/lib/esm/position.d.mts +55 -0
- package/dist/lib/esm/position.mjs +23 -0
- package/dist/lib/esm/reference.mjs +10 -7
- package/package.json +2 -2
package/dist/lib/esm/link.d.mts
CHANGED
|
@@ -69,20 +69,20 @@ export declare enum LinkStyle {
|
|
|
69
69
|
/**
|
|
70
70
|
* Params passed to the link converter of {@link editBacklinksSnapshot}.
|
|
71
71
|
*
|
|
72
|
-
* @typeParam TPayload - The payload recorded for each
|
|
72
|
+
* @typeParam TPayload - The payload recorded for each reference when the snapshot was built.
|
|
73
73
|
*/
|
|
74
74
|
export interface BacklinkConversionParams<TPayload> {
|
|
75
|
-
/**
|
|
76
|
-
* The link being converted.
|
|
77
|
-
*/
|
|
78
|
-
readonly link: Reference;
|
|
79
75
|
/**
|
|
80
76
|
* The payload captured for the link when the snapshot was built.
|
|
81
77
|
*
|
|
82
78
|
* `undefined` when the link is not in the snapshot, which can only happen if
|
|
83
|
-
* {@link EditBacklinksSnapshotParams.
|
|
79
|
+
* {@link EditBacklinksSnapshotParams.shouldVisitUnmatchedReferences} is `true`.
|
|
84
80
|
*/
|
|
85
81
|
readonly payload: TPayload | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* The reference being converted.
|
|
84
|
+
*/
|
|
85
|
+
readonly reference: Reference;
|
|
86
86
|
/**
|
|
87
87
|
* The path of the note holding the link.
|
|
88
88
|
*/
|
|
@@ -118,34 +118,23 @@ export interface BacklinksLike {
|
|
|
118
118
|
* the metadata cache for the old path, so a caller that rewrites links **after** renaming has to capture the
|
|
119
119
|
* backlinks **before** — which is why {@link editBacklinksSnapshot} takes a snapshot rather than a path.
|
|
120
120
|
*
|
|
121
|
-
* The payload is whatever the caller needs to remember per
|
|
122
|
-
* rewrite (the target is implied), and the old target's path for a multi-target one, where one note's
|
|
123
|
-
* may point at several files that all moved and each
|
|
121
|
+
* The payload is whatever the caller needs to remember per reference. It is `undefined` for a single-target
|
|
122
|
+
* rewrite (the target is implied), and the old target's path for a multi-target one, where one note's references
|
|
123
|
+
* may point at several files that all moved and each reference has to be resolved to its own new path.
|
|
124
124
|
*
|
|
125
|
-
* @typeParam TPayload - The payload recorded for each
|
|
125
|
+
* @typeParam TPayload - The payload recorded for each reference.
|
|
126
126
|
*/
|
|
127
127
|
export type BacklinksSnapshot<TPayload> = ReadonlyMap<string, ReadonlyMap<string, TPayload>>;
|
|
128
128
|
/**
|
|
129
129
|
* Params for {@link buildBacklinksSnapshot}.
|
|
130
130
|
*
|
|
131
|
-
* @typeParam TPayload - The payload recorded for each
|
|
131
|
+
* @typeParam TPayload - The payload recorded for each reference.
|
|
132
132
|
*/
|
|
133
133
|
export interface BuildBacklinksSnapshotParams<TPayload> {
|
|
134
134
|
/**
|
|
135
135
|
* The backlinks to record.
|
|
136
136
|
*/
|
|
137
137
|
readonly backlinks: BacklinksLike;
|
|
138
|
-
/**
|
|
139
|
-
* Computes the identity key of a link.
|
|
140
|
-
*
|
|
141
|
-
* The snapshot remembers it, so {@link editBacklinksSnapshot} looks the links up with the same function
|
|
142
|
-
* without being told. When {@link BuildBacklinksSnapshotParams.target} was built with a provider, omitting
|
|
143
|
-
* this reuses that one, and passing a different one throws: a snapshot keyed by two functions matches
|
|
144
|
-
* nothing.
|
|
145
|
-
*
|
|
146
|
-
* @default the provider `target` was built with, else `JSON.stringify`
|
|
147
|
-
*/
|
|
148
|
-
readonly linkIdentityKeyProvider?: (link: Reference) => string;
|
|
149
138
|
/**
|
|
150
139
|
* Rewrites the path of a backlink-holding note as it will be **after** the operation.
|
|
151
140
|
*
|
|
@@ -159,10 +148,21 @@ export interface BuildBacklinksSnapshotParams<TPayload> {
|
|
|
159
148
|
/**
|
|
160
149
|
* Produces the payload to record for a link. See {@link BacklinksSnapshot} for what a payload is for.
|
|
161
150
|
*
|
|
162
|
-
* @param
|
|
151
|
+
* @param reference - The reference being recorded.
|
|
163
152
|
* @returns The payload.
|
|
164
153
|
*/
|
|
165
|
-
readonly payloadProvider: (
|
|
154
|
+
readonly payloadProvider: (reference: Reference) => TPayload;
|
|
155
|
+
/**
|
|
156
|
+
* Computes the identity key of a link.
|
|
157
|
+
*
|
|
158
|
+
* The snapshot remembers it, so {@link editBacklinksSnapshot} looks the links up with the same function
|
|
159
|
+
* without being told. When {@link BuildBacklinksSnapshotParams.target} was built with a provider, omitting
|
|
160
|
+
* this reuses that one, and passing a different one throws: a snapshot keyed by two functions matches
|
|
161
|
+
* nothing.
|
|
162
|
+
*
|
|
163
|
+
* @default the provider `target` was built with, else `JSON.stringify`
|
|
164
|
+
*/
|
|
165
|
+
readonly referenceIdentityKeyProvider?: (reference: Reference) => string;
|
|
166
166
|
/**
|
|
167
167
|
* An existing snapshot to merge into, so several sets of backlinks can be accumulated into one.
|
|
168
168
|
*
|
|
@@ -194,10 +194,6 @@ export interface ConvertLinkParams {
|
|
|
194
194
|
* @default `true`
|
|
195
195
|
*/
|
|
196
196
|
readonly isEmptyEmbedAliasAllowed?: boolean;
|
|
197
|
-
/**
|
|
198
|
-
* A reference for the link.
|
|
199
|
-
*/
|
|
200
|
-
readonly link: Reference;
|
|
201
197
|
/**
|
|
202
198
|
* A style of the link path.
|
|
203
199
|
*/
|
|
@@ -214,6 +210,10 @@ export interface ConvertLinkParams {
|
|
|
214
210
|
* An old path of the link.
|
|
215
211
|
*/
|
|
216
212
|
readonly oldSourcePathOrFile?: PathOrFile;
|
|
213
|
+
/**
|
|
214
|
+
* The reference whose link is converted.
|
|
215
|
+
*/
|
|
216
|
+
readonly reference: Reference;
|
|
217
217
|
/**
|
|
218
218
|
* Whether to escape the alias.
|
|
219
219
|
*
|
|
@@ -293,10 +293,6 @@ export interface EditBacklinksParams extends EditBacklinksOptions {
|
|
|
293
293
|
* The Obsidian application instance.
|
|
294
294
|
*/
|
|
295
295
|
readonly app: App;
|
|
296
|
-
/**
|
|
297
|
-
* The function that converts each link.
|
|
298
|
-
*/
|
|
299
|
-
readonly linkConverter: (link: Reference) => Promisable<MaybeReturn<string>>;
|
|
300
296
|
/**
|
|
301
297
|
* An optional reporter invoked once per backlink file after its links are updated, with the running
|
|
302
298
|
* count of processed files and the total. When omitted, no progress is reported.
|
|
@@ -306,6 +302,10 @@ export interface EditBacklinksParams extends EditBacklinksOptions {
|
|
|
306
302
|
* The path or file to edit the backlinks for.
|
|
307
303
|
*/
|
|
308
304
|
readonly pathOrFile: PathOrFile;
|
|
305
|
+
/**
|
|
306
|
+
* The function that converts each reference.
|
|
307
|
+
*/
|
|
308
|
+
readonly referenceConverter: (reference: Reference) => Promisable<MaybeReturn<string>>;
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
311
311
|
* Options for {@link editBacklinksSnapshot}.
|
|
@@ -314,7 +314,7 @@ export type EditBacklinksSnapshotOptions = ProcessOptions;
|
|
|
314
314
|
/**
|
|
315
315
|
* Parameters for {@link editBacklinksSnapshot}.
|
|
316
316
|
*
|
|
317
|
-
* @typeParam TPayload - The payload recorded for each
|
|
317
|
+
* @typeParam TPayload - The payload recorded for each reference when the snapshot was built.
|
|
318
318
|
*/
|
|
319
319
|
export interface EditBacklinksSnapshotParams<TPayload> extends EditBacklinksSnapshotOptions {
|
|
320
320
|
/**
|
|
@@ -322,9 +322,14 @@ export interface EditBacklinksSnapshotParams<TPayload> extends EditBacklinksSnap
|
|
|
322
322
|
*/
|
|
323
323
|
readonly app: App;
|
|
324
324
|
/**
|
|
325
|
-
*
|
|
325
|
+
* An optional reporter invoked once per backlink file after its links are updated, with the running
|
|
326
|
+
* count of processed files and the total. When omitted, no progress is reported.
|
|
327
|
+
*/
|
|
328
|
+
readonly linkUpdateProgressReporter?: LinkUpdateProgressReporter;
|
|
329
|
+
/**
|
|
330
|
+
* The function that converts each reference.
|
|
326
331
|
*/
|
|
327
|
-
readonly
|
|
332
|
+
readonly referenceConverter: (params: BacklinkConversionParams<TPayload>) => Promisable<MaybeReturn<string>>;
|
|
328
333
|
/**
|
|
329
334
|
* Computes the identity key of a link.
|
|
330
335
|
*
|
|
@@ -335,12 +340,7 @@ export interface EditBacklinksSnapshotParams<TPayload> extends EditBacklinksSnap
|
|
|
335
340
|
*
|
|
336
341
|
* @default the provider the snapshot was built with, else `JSON.stringify`
|
|
337
342
|
*/
|
|
338
|
-
readonly
|
|
339
|
-
/**
|
|
340
|
-
* An optional reporter invoked once per backlink file after its links are updated, with the running
|
|
341
|
-
* count of processed files and the total. When omitted, no progress is reported.
|
|
342
|
-
*/
|
|
343
|
-
readonly linkUpdateProgressReporter?: LinkUpdateProgressReporter;
|
|
343
|
+
readonly referenceIdentityKeyProvider?: (reference: Reference) => string;
|
|
344
344
|
/**
|
|
345
345
|
* Whether the converter is also shown links that are **not** in the snapshot, with an `undefined`
|
|
346
346
|
* {@link BacklinkConversionParams.payload}.
|
|
@@ -352,16 +352,16 @@ export interface EditBacklinksSnapshotParams<TPayload> extends EditBacklinksSnap
|
|
|
352
352
|
*
|
|
353
353
|
* @default `false`
|
|
354
354
|
*/
|
|
355
|
-
readonly
|
|
355
|
+
readonly shouldVisitUnmatchedReferences?: boolean;
|
|
356
356
|
/**
|
|
357
357
|
* The captured backlinks to edit.
|
|
358
358
|
*/
|
|
359
359
|
readonly snapshot: BacklinksSnapshot<TPayload>;
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
362
|
-
* Parameters for {@link
|
|
362
|
+
* Parameters for {@link editReferencesInContent}.
|
|
363
363
|
*/
|
|
364
|
-
export interface
|
|
364
|
+
export interface EditReferencesInContentParams {
|
|
365
365
|
/**
|
|
366
366
|
* The abort signal to control the execution of the function.
|
|
367
367
|
*/
|
|
@@ -375,11 +375,7 @@ export interface EditLinksInContentParams {
|
|
|
375
375
|
*/
|
|
376
376
|
readonly content: string;
|
|
377
377
|
/**
|
|
378
|
-
*
|
|
379
|
-
*/
|
|
380
|
-
readonly linkConverter: (link: Reference) => Promisable<MaybeReturn<string>>;
|
|
381
|
-
/**
|
|
382
|
-
* A range within {@link EditLinksInContentParams.content}, in character offsets, restricting the pass to
|
|
378
|
+
* A range within {@link EditReferencesInContentParams.content}, in character offsets, restricting the pass to
|
|
383
379
|
* the links inside it. When omitted, every link is visited.
|
|
384
380
|
*
|
|
385
381
|
* A link is edited only when it is **fully contained** in the range; one that merely overlaps it is left
|
|
@@ -392,6 +388,10 @@ export interface EditLinksInContentParams {
|
|
|
392
388
|
* @default `undefined`
|
|
393
389
|
*/
|
|
394
390
|
readonly offsetRange?: OffsetRange;
|
|
391
|
+
/**
|
|
392
|
+
* The function that converts each reference.
|
|
393
|
+
*/
|
|
394
|
+
readonly referenceConverter: (reference: Reference) => Promisable<MaybeReturn<string>>;
|
|
395
395
|
/**
|
|
396
396
|
* Whether to also edit external links parsed from the note body. When `true`, the converter also
|
|
397
397
|
* receives references for external links.
|
|
@@ -421,24 +421,20 @@ export interface EditLinksInContentParams {
|
|
|
421
421
|
*
|
|
422
422
|
* @default `false`
|
|
423
423
|
*/
|
|
424
|
-
readonly
|
|
424
|
+
readonly shouldSkipReferencesInHeadings?: boolean;
|
|
425
425
|
}
|
|
426
426
|
/**
|
|
427
|
-
* Options for {@link
|
|
427
|
+
* Options for {@link editReferences}.
|
|
428
428
|
*/
|
|
429
|
-
export type
|
|
429
|
+
export type EditReferencesOptions = ProcessOptions;
|
|
430
430
|
/**
|
|
431
|
-
* Parameters for {@link
|
|
431
|
+
* Parameters for {@link editReferences}.
|
|
432
432
|
*/
|
|
433
|
-
export interface
|
|
433
|
+
export interface EditReferencesParams extends EditReferencesOptions {
|
|
434
434
|
/**
|
|
435
435
|
* The Obsidian application instance.
|
|
436
436
|
*/
|
|
437
437
|
readonly app: App;
|
|
438
|
-
/**
|
|
439
|
-
* The function that converts each link.
|
|
440
|
-
*/
|
|
441
|
-
readonly linkConverter: (link: Reference) => Promisable<MaybeReturn<string>>;
|
|
442
438
|
/**
|
|
443
439
|
* A range within the file's content, in character offsets, restricting the pass to the links inside it.
|
|
444
440
|
* When omitted, every link is visited.
|
|
@@ -463,6 +459,10 @@ export interface EditLinksParams extends EditLinksOptions {
|
|
|
463
459
|
* The path or file to edit the links for.
|
|
464
460
|
*/
|
|
465
461
|
readonly pathOrFile: PathOrFile;
|
|
462
|
+
/**
|
|
463
|
+
* The function that converts each reference.
|
|
464
|
+
*/
|
|
465
|
+
readonly referenceConverter: (reference: Reference) => Promisable<MaybeReturn<string>>;
|
|
466
466
|
/**
|
|
467
467
|
* Whether to also edit external links parsed from the note body. When `true`, the converter also
|
|
468
468
|
* receives references for external links.
|
|
@@ -492,20 +492,20 @@ export interface EditLinksParams extends EditLinksOptions {
|
|
|
492
492
|
*
|
|
493
493
|
* @default `false`
|
|
494
494
|
*/
|
|
495
|
-
readonly
|
|
495
|
+
readonly shouldSkipReferencesInHeadings?: boolean;
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
498
|
-
* Parameters for {@link
|
|
498
|
+
* Parameters for {@link extractReferenceFile}.
|
|
499
499
|
*/
|
|
500
|
-
export interface
|
|
500
|
+
export interface ExtractReferenceFileParams {
|
|
501
501
|
/**
|
|
502
502
|
* The Obsidian application instance.
|
|
503
503
|
*/
|
|
504
504
|
readonly app: App;
|
|
505
505
|
/**
|
|
506
|
-
* The reference
|
|
506
|
+
* The reference to resolve.
|
|
507
507
|
*/
|
|
508
|
-
readonly
|
|
508
|
+
readonly reference: Reference;
|
|
509
509
|
/**
|
|
510
510
|
* Whether to allow non-existing files.
|
|
511
511
|
*
|
|
@@ -716,7 +716,7 @@ export interface GenerateRawMarkdownLinkParams {
|
|
|
716
716
|
/**
|
|
717
717
|
* A {@link BacklinksSnapshot} while it is still being accumulated by {@link buildBacklinksSnapshot}.
|
|
718
718
|
*
|
|
719
|
-
* @typeParam TPayload - The payload recorded for each
|
|
719
|
+
* @typeParam TPayload - The payload recorded for each reference.
|
|
720
720
|
*/
|
|
721
721
|
export type MutableBacklinksSnapshot<TPayload> = Map<string, Map<string, TPayload>>;
|
|
722
722
|
/**
|
|
@@ -797,11 +797,11 @@ export interface UpdateFileUrlLinksInContentParams {
|
|
|
797
797
|
readonly offsetRange?: OffsetRange;
|
|
798
798
|
/**
|
|
799
799
|
* Whether to leave every link inside a heading unchanged. See
|
|
800
|
-
* {@link
|
|
800
|
+
* {@link EditReferencesInContentParams.shouldSkipReferencesInHeadings}.
|
|
801
801
|
*
|
|
802
802
|
* @default `false`
|
|
803
803
|
*/
|
|
804
|
-
readonly
|
|
804
|
+
readonly shouldSkipReferencesInHeadings?: boolean;
|
|
805
805
|
/**
|
|
806
806
|
* Whether to emit the normalized links with angle brackets and raw spaces instead of `%20`-encoding.
|
|
807
807
|
*
|
|
@@ -842,11 +842,11 @@ export interface UpdateFileUrlLinksInFileParams extends ProcessOptions {
|
|
|
842
842
|
*/
|
|
843
843
|
readonly pathOrFile: PathOrFile;
|
|
844
844
|
/**
|
|
845
|
-
* Whether to leave every link inside a heading unchanged. See {@link
|
|
845
|
+
* Whether to leave every link inside a heading unchanged. See {@link EditReferencesParams.shouldSkipReferencesInHeadings}.
|
|
846
846
|
*
|
|
847
847
|
* @default `false`
|
|
848
848
|
*/
|
|
849
|
-
readonly
|
|
849
|
+
readonly shouldSkipReferencesInHeadings?: boolean;
|
|
850
850
|
/**
|
|
851
851
|
* Whether to emit the normalized links with angle brackets and raw spaces instead of `%20`-encoding.
|
|
852
852
|
*
|
|
@@ -874,10 +874,6 @@ export interface UpdateLinkParams {
|
|
|
874
874
|
* @default `true`
|
|
875
875
|
*/
|
|
876
876
|
readonly isEmptyEmbedAliasAllowed?: boolean;
|
|
877
|
-
/**
|
|
878
|
-
* A reference for the link.
|
|
879
|
-
*/
|
|
880
|
-
readonly link: Reference;
|
|
881
877
|
/**
|
|
882
878
|
* A style of the link path.
|
|
883
879
|
*/
|
|
@@ -902,6 +898,10 @@ export interface UpdateLinkParams {
|
|
|
902
898
|
* An old path of the file.
|
|
903
899
|
*/
|
|
904
900
|
readonly oldTargetPathOrFile?: PathOrFile;
|
|
901
|
+
/**
|
|
902
|
+
* The reference whose link is updated.
|
|
903
|
+
*/
|
|
904
|
+
readonly reference: Reference;
|
|
905
905
|
/**
|
|
906
906
|
* Whether to escape the alias.
|
|
907
907
|
*
|
|
@@ -970,9 +970,9 @@ export interface UpdateLinkParams {
|
|
|
970
970
|
readonly shouldUseLeadingSlashForAbsolutePaths?: boolean;
|
|
971
971
|
}
|
|
972
972
|
/**
|
|
973
|
-
* Params for {@link
|
|
973
|
+
* Params for {@link updateReferencesInFile}.
|
|
974
974
|
*/
|
|
975
|
-
export interface
|
|
975
|
+
export interface UpdateReferencesInFileParams extends ProcessOptions {
|
|
976
976
|
/**
|
|
977
977
|
* An Obsidian app instance.
|
|
978
978
|
*/
|
|
@@ -1007,7 +1007,7 @@ export interface UpdateLinksInFileParams extends ProcessOptions {
|
|
|
1007
1007
|
*
|
|
1008
1008
|
* @default `undefined`
|
|
1009
1009
|
*/
|
|
1010
|
-
readonly linkStyleProvider?: (
|
|
1010
|
+
readonly linkStyleProvider?: (reference: Reference) => LinkStyle | undefined;
|
|
1011
1011
|
/**
|
|
1012
1012
|
* A file to update the links in.
|
|
1013
1013
|
*/
|
|
@@ -1068,7 +1068,7 @@ export interface UpdateLinksInFileParams extends ProcessOptions {
|
|
|
1068
1068
|
*
|
|
1069
1069
|
* @default `false`
|
|
1070
1070
|
*/
|
|
1071
|
-
readonly
|
|
1071
|
+
readonly shouldSkipReferencesInHeadings?: boolean;
|
|
1072
1072
|
/**
|
|
1073
1073
|
* Whether to update only embedded links.
|
|
1074
1074
|
*/
|
|
@@ -1117,9 +1117,9 @@ export interface UpdateLinksInFileParams extends ProcessOptions {
|
|
|
1117
1117
|
readonly shouldUseLeadingSlashForAbsolutePaths?: boolean;
|
|
1118
1118
|
}
|
|
1119
1119
|
/**
|
|
1120
|
-
* Params for {@link
|
|
1120
|
+
* Params for {@link updateReferencesInContent}.
|
|
1121
1121
|
*/
|
|
1122
|
-
interface
|
|
1122
|
+
interface UpdateReferencesInContentParams {
|
|
1123
1123
|
/**
|
|
1124
1124
|
* An Obsidian app instance.
|
|
1125
1125
|
*/
|
|
@@ -1158,13 +1158,13 @@ interface UpdateLinksInContentParams {
|
|
|
1158
1158
|
*
|
|
1159
1159
|
* @default `undefined`
|
|
1160
1160
|
*/
|
|
1161
|
-
readonly linkStyleProvider?: (
|
|
1161
|
+
readonly linkStyleProvider?: (reference: Reference) => LinkStyle | undefined;
|
|
1162
1162
|
/**
|
|
1163
1163
|
* A new source path or file.
|
|
1164
1164
|
*/
|
|
1165
1165
|
readonly newSourcePathOrFile: PathOrFile;
|
|
1166
1166
|
/**
|
|
1167
|
-
* A range within {@link
|
|
1167
|
+
* A range within {@link UpdateReferencesInContentParams.content}, in character offsets, restricting the pass
|
|
1168
1168
|
* to the links inside it. When omitted, every link is visited.
|
|
1169
1169
|
*
|
|
1170
1170
|
* A link is updated only when it is **fully contained** in the range; one that merely overlaps it is left
|
|
@@ -1213,7 +1213,7 @@ interface UpdateLinksInContentParams {
|
|
|
1213
1213
|
*
|
|
1214
1214
|
* @default `false`
|
|
1215
1215
|
*/
|
|
1216
|
-
readonly
|
|
1216
|
+
readonly shouldSkipReferencesInHeadings?: boolean;
|
|
1217
1217
|
/**
|
|
1218
1218
|
* Whether to update only embedded links.
|
|
1219
1219
|
*/
|
|
@@ -1267,7 +1267,7 @@ interface UpdateLinksInContentParams {
|
|
|
1267
1267
|
* Call it once per target and pass {@link BuildBacklinksSnapshotParams.target} to accumulate several targets
|
|
1268
1268
|
* into one snapshot, so that a note linking to several of them is still rewritten exactly once.
|
|
1269
1269
|
*
|
|
1270
|
-
* @typeParam TPayload - The payload recorded for each
|
|
1270
|
+
* @typeParam TPayload - The payload recorded for each reference.
|
|
1271
1271
|
* @param params - The parameters for building the snapshot.
|
|
1272
1272
|
* @returns The snapshot — {@link BuildBacklinksSnapshotParams.target} itself when one was passed.
|
|
1273
1273
|
*/
|
|
@@ -1293,7 +1293,7 @@ export declare function editBacklinks(params: EditBacklinksParams): Promise<void
|
|
|
1293
1293
|
* because the rename that invalidated them has already happened — or that rewrite links to several targets
|
|
1294
1294
|
* at once. See {@link BacklinksSnapshot} for both cases.
|
|
1295
1295
|
*
|
|
1296
|
-
* @typeParam TPayload - The payload recorded for each
|
|
1296
|
+
* @typeParam TPayload - The payload recorded for each reference when the snapshot was built.
|
|
1297
1297
|
* @param params - The parameters for editing the backlinks.
|
|
1298
1298
|
* @returns A {@link Promise} that resolves when the backlinks have been edited.
|
|
1299
1299
|
*/
|
|
@@ -1304,21 +1304,21 @@ export declare function editBacklinksSnapshot<TPayload>(params: EditBacklinksSna
|
|
|
1304
1304
|
* @param params - The parameters for editing the links.
|
|
1305
1305
|
* @returns A {@link Promise} that resolves when the links have been edited.
|
|
1306
1306
|
*/
|
|
1307
|
-
export declare function
|
|
1307
|
+
export declare function editReferences(params: EditReferencesParams): Promise<void>;
|
|
1308
1308
|
/**
|
|
1309
1309
|
* Edits the links in a content string.
|
|
1310
1310
|
*
|
|
1311
1311
|
* @param params - The parameters for editing the links in the content.
|
|
1312
1312
|
* @returns The promise that resolves to the updated content.
|
|
1313
1313
|
*/
|
|
1314
|
-
export declare function
|
|
1314
|
+
export declare function editReferencesInContent(params: EditReferencesInContentParams): Promise<string>;
|
|
1315
1315
|
/**
|
|
1316
1316
|
* Extracts the file associated with a link.
|
|
1317
1317
|
*
|
|
1318
1318
|
* @param params - The parameters for extracting the link file.
|
|
1319
1319
|
* @returns The file associated with the link, or `null` if not found.
|
|
1320
1320
|
*/
|
|
1321
|
-
export declare function
|
|
1321
|
+
export declare function extractReferenceFile(params: ExtractReferenceFileParams): null | TFile;
|
|
1322
1322
|
/**
|
|
1323
1323
|
* Generates a markdown link based on the provided parameters.
|
|
1324
1324
|
*
|
|
@@ -1428,12 +1428,12 @@ export declare function updateLink(params: UpdateLinkParams): string;
|
|
|
1428
1428
|
* @param params - The parameters for updating the links.
|
|
1429
1429
|
* @returns A {@link Promise} that resolves to the content with updated links.
|
|
1430
1430
|
*/
|
|
1431
|
-
export declare function
|
|
1431
|
+
export declare function updateReferencesInContent(params: UpdateReferencesInContentParams): Promise<string>;
|
|
1432
1432
|
/**
|
|
1433
1433
|
* Updates the links in a file based on the provided parameters.
|
|
1434
1434
|
*
|
|
1435
1435
|
* @param params - The parameters for updating the links.
|
|
1436
1436
|
* @returns A {@link Promise} that resolves when the links are updated.
|
|
1437
1437
|
*/
|
|
1438
|
-
export declare function
|
|
1438
|
+
export declare function updateReferencesInFile(params: UpdateReferencesInFileParams): Promise<void>;
|
|
1439
1439
|
export {};
|