UpdateReferencesInFileParams
Params for updateReferencesInFile.
Import:
import type { UpdateReferencesInFileParams } from '@mnaoumov/obsidian-lib/link';Signature:
export interface UpdateReferencesInFileParams extends ProcessOptionsExtends: ProcessOptions
Properties
| Property | Type | Description |
|---|---|---|
| app | App | An Obsidian app instance. |
| isEmptyEmbedAliasAllowed? | boolean | Whether to allow an empty alias for embeds. Applicable only if the result link style is LinkStyle.Markdown.If true: .If false: !. |
| linkPathStyle? | LinkPathStyle | A style of the link path. |
| linkStyle? | LinkStyle | A style of the link. |
| linkStyleProvider? | (reference: Reference) => LinkStyle | null | Decides the style of one link, overriding linkStyle for it. Returning null keeps linkStyle.Use it when one style for the whole file is wrong for some of its links. A caller forcing LinkStyle.Markdown over a note, for example, keeps a frontmatter wikilink a wikilink, because Obsidian reads a property value as a link only in that form. |
| newSourcePathOrFile | PathOrFile | A file to update the links in. |
| offsetRange? | OffsetRange | A range within the file's content, in character offsets, restricting the pass to the links inside it. When omitted, every link is visited. A link is updated only when it is **fully contained** in the range; one that merely overlaps it is left alone, because rewriting part of a link corrupts it. Both bounds are inclusive, so a range whose offsets coincide exactly with a link's does include that link. A reference that carries no position within the file's content — a frontmatter link, a multi-link frontmatter value entry, or any canvas reference — is never in range and is skipped whenever a range is supplied. The offsets are into the content this function reads from the vault. Before reading, it saves any unsaved editor buffer for the file, so a range taken from an open editor via Editor.posToOffset is valid. The caller owns only the case where the buffer changes between computing the range and this call. |
| oldSourcePathOrFile? | PathOrFile | An old path of the file. |
| pluginNoticeComponent | null | PluginNoticeComponent | Plugin notice component used to show the timeout notice. When null, no timeout notice is shown regardless of ProcessOptions.shouldShowTimeoutNotice; the timeout is only logged.(Inherited from ProcessOptions) |
| resourceLockComponent | null | ResourceLockComponent | An resource-lock component used to lock the file's editor read-only for the duration of processing. The lock is reference-counted, so it composes with any outer operation-level lock on the same note. (Inherited from ProcessOptions) |
| shouldEscapeAlias? | boolean | Whether to escape the alias. Applicable only if the result link style is LinkStyle.Markdown.If true: .If false: . |
| shouldFailOnMissingFile? | boolean | Whether to fail if the file is missing or deleted. (Inherited from ProcessOptions) |
| shouldIncludeAttachmentExtensionToEmbedAlias? | boolean | Whether to include the attachment extension in the embed alias. Applicable only if isEmptyEmbedAliasAllowed is false.If true: .If false: . |
| shouldShowTimeoutNotice? | boolean | Whether to show a timeout notice. (Inherited from ProcessOptions) |
| shouldSkipReference? | ((reference: Reference) => boolean) | null | A predicate choosing links to leave unchanged: for each reference it returns true for, the converter is not called, so the link stays byte-for-byte as written — its path, style, angle brackets and leading dot included. Use it to exclude links the caller decides on, for example by their resolved target path.Applied after the heading skip and the offset range. null behaves like an absent key, so a predicate factory that returns null when nothing is excluded can be passed straight through. |
| shouldSkipReferencesInHeadings? | boolean | Whether to leave every link inside a heading unchanged: it is neither converted nor restyled, so it stays byte-for-byte as written. A link in a heading is part of the heading's text, so rewriting it changes that text and breaks every #heading subpath pointing at the heading. See isReferenceInHeading. |
| shouldUpdateEmbedOnlyLinks? | boolean | Whether to update only embedded links. |
| shouldUpdateFileNameAlias? | boolean | Whether to update file name alias. |
| shouldUseAngleBrackets? | boolean | Indicates if the link should use angle brackets. Applicable only if linkStyle is LinkStyle.Markdown.If true: .If false: . |
| shouldUseLeadingDotForRelativePaths? | boolean | Indicates if the link should use a leading dot. Applicable only if linkPathStyle is LinkPathStyle.RelativePathToTheSource.If true: [[./relative/path/to/target]]If false: [[relative/path/to/target]] |
| shouldUseLeadingSlashForAbsolutePaths? | boolean | Indicates if the link should use a leading slash. Applicable only if linkPathStyle is LinkPathStyle.AbsolutePathInVault.If true: [[/absolute/path/to/target]]If false: [[absolute/path/to/target]] |
Links to this page: